-
Notifications
You must be signed in to change notification settings - Fork 230
/
App.vue
56 lines (51 loc) · 983 Bytes
/
App.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<template>
<div id="app">
<vue-page-designer
:value="value"
:widgets="widgets"
:upload="handleUpload"
:upload-option="uploadOption"
locale="cn"
@save="handleSave" />
</div>
</template>
<script>
import widgets from './widgets'
export default {
data () {
return {
value: null,
widgets,
uploadOption: {
url: 'https://jsonplaceholder.typicode.com/photos'
}
}
},
created () {
let data = window.localStorage.getItem('vpd-data')
if (data) {
this.value = JSON.parse(data)
}
},
methods: {
handleSave (data) {
console.log('saving:', data)
window.localStorage.setItem('vpd-data', JSON.stringify(data))
},
handleUpload (files) {
console.log('uploading:', files)
return new Promise(resolve => {
resolve({
files: files,
status: 200
})
})
}
}
}
</script>
<style>
#app {
height: 100%;
}
</style>