File tree Expand file tree Collapse file tree 5 files changed +21
-17
lines changed Expand file tree Collapse file tree 5 files changed +21
-17
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " main" ,
3
- "version" : " 0.0 .0" ,
3
+ "version" : " 0.1 .0" ,
4
4
"description" : " Some composables form validator for vue" ,
5
5
"license" : " MIT" ,
6
6
"author" : " Snowingfox" ,
7
7
"main" : " index.js" ,
8
8
"scripts" : {
9
9
"lint" : " eslint --cache ." ,
10
10
"core:build" : " cd packages/core && npm run build" ,
11
- "play:build" : " cd playground && npm run build" ,
11
+ "play:build" : " pnpm i && npm run core:build && cd playground && npm run build" ,
12
12
"play:dev" : " npm run core:build && cd playground && npm run dev"
13
13
},
14
14
"peerDependencies" : {
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " vue-use-form" ,
3
- "version" : " 0.0.1 " ,
3
+ "version" : " 0.1.0 " ,
4
4
"description" : " " ,
5
5
"keywords" : [
6
6
" vue" ,
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @vue-use-form/playground" ,
3
- "version" : " 0.0.1 " ,
3
+ "version" : " 0.1.0 " ,
4
4
"private" : true ,
5
5
"scripts" : {
6
6
"dev" : " vite" ,
7
7
"build" : " vite build" ,
8
8
"serve" : " vite preview"
9
9
},
10
- "devDependencies" : {
11
- "@vitejs/plugin-vue" : " ^1.10.2" ,
12
- "vite" : " 2.9.14"
13
- },
14
10
"dependencies" : {
15
11
"@vue/repl" : " ^1.3.0" ,
16
12
"file-saver" : " ^2.0.5" ,
17
13
"jszip" : " ^3.6.0" ,
18
14
"vue" : " 3.2.38"
15
+ },
16
+ "devDependencies" : {
17
+ "@vitejs/plugin-vue" : " ^1.10.2" ,
18
+ "vite" : " 2.9.14"
19
19
}
20
20
}
Original file line number Diff line number Diff line change @@ -23,8 +23,10 @@ if (hash.startsWith('__SSR__')) {
23
23
useSSRMode .value = true
24
24
}
25
25
26
+ const serializedState = location .hash .slice (1 )
27
+
26
28
const store = new ReplStore ({
27
- serializedState: hash ,
29
+ serializedState ,
28
30
defaultVueRuntimeURL: import .meta .env .PROD
29
31
? ` ${location .origin }/vue.runtime.esm-browser.js `
30
32
: ` ${location .origin }/src/vue-dev-proxy ` ,
@@ -36,15 +38,17 @@ const store = new ReplStore({
36
38
store .setImportMap ({
37
39
imports: {
38
40
' vue-use-form' : import .meta .env .PROD
39
- ? ` ${location .origin }/vue-use-form.js `
40
- : ` ${location .origin }/src/vue-use-form-dev-proxy ` ,
41
+ ? ` ${location .origin }/vue-use-form.js `
42
+ : ` ${location .origin }/src/vue-use-form-dev-proxy ` ,
41
43
},
42
44
})
43
45
44
- store .setFiles ({
45
- ' import-map.json' : store .getFiles ()[' import-map.json' ],
46
- ' App.vue' : AppCode ,
47
- })
46
+ if (! serializedState ) {
47
+ store .setFiles ({
48
+ ' import-map.json' : store .getFiles ()[' import-map.json' ],
49
+ ' App.vue' : AppCode ,
50
+ })
51
+ }
48
52
49
53
// enable experimental features
50
54
const sfcOptions = {
Original file line number Diff line number Diff line change 1
1
export const AppCode = `<script setup>
2
- import {createErrorHandler, createSubmitHandler, useForm } from 'vue-use-form'
2
+ import { createErrorHandler, createSubmitHandler, useForm } from 'vue-use-form'
3
3
4
4
const {
5
5
register,
@@ -16,7 +16,7 @@ const onSubmit = createSubmitHandler((data) => {
16
16
17
17
const onError = createErrorHandler((errors) => {
18
18
alert('submit failed')
19
- } )
19
+ })
20
20
</script>
21
21
<template>
22
22
{{ errors }}
You can’t perform that action at this time.
0 commit comments