File tree Expand file tree Collapse file tree 6 files changed +23
-28
lines changed Expand file tree Collapse file tree 6 files changed +23
-28
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,6 @@ You can add custom components, save callback.
51
51
| save | ` (data) => void ` | When you click the Save button, feed back to you to save the data |
52
52
| value | ` Object ` | Editor initial value, you can pass the value of the save callback and resume the draft |
53
53
| widgets | ` Object ` | Vue Components. Custom components for editor. see [ Example] ( https://github.com/fireyy/vue-page-designer-widgets/blob/master/src/index.js ) |
54
- | widgetStyle | ` Object ` | Vue Components. Custom components style config for editor. see [ Example] ( https://github.com/fireyy/vue-page-designer-widgets/blob/master/src/index.js ) |
55
54
56
55
## Parameter: ` save `
57
56
@@ -75,7 +74,7 @@ The `value` came from `save`.
75
74
</template >
76
75
```
77
76
78
- ## Parameter: ` widgets ` and ` widgetStyle `
77
+ ## Parameter: ` widgets `
79
78
80
79
You can install default widget in ` vue-page-designer-widgets `
81
80
@@ -88,18 +87,17 @@ Import and use it
88
87
``` html
89
88
<template >
90
89
<div id =" app" >
91
- <vue-page-designer :widgets =" widgets" :widgetStyle = " widgetStyle " />
90
+ <vue-page-designer :widgets =" widgets" />
92
91
</div >
93
92
</template >
94
93
<script >
95
94
import vuePageDesigner from ' vue-page-designer'
96
- import { widgets , widgetStyle } from ' vue-page-designer-widgets'
95
+ import widgets from ' vue-page-designer-widgets'
97
96
98
97
export default {
99
98
data () {
100
99
return {
101
- widgets,
102
- widgetStyle
100
+ widgets
103
101
}
104
102
},
105
103
Original file line number Diff line number Diff line change 1
1
<template >
2
2
<div id =" app" >
3
- <vue-page-designer :value =" value" :widgets =" widgets" :widgetStyle = " widgetStyle " @save =" handleSave" />
3
+ <vue-page-designer :value =" value" :widgets =" widgets" @save =" handleSave" />
4
4
</div >
5
5
</template >
6
6
7
7
<script >
8
- import { widgets , widgetStyle } from ' vue-page-designer-widgets'
8
+ import widgets from ' vue-page-designer-widgets'
9
9
import vuePageDesigner from ' ../src'
10
10
11
11
export default {
12
12
data () {
13
13
return {
14
14
value: null ,
15
- widgets,
16
- widgetStyle
15
+ widgets
17
16
}
18
17
},
19
18
Original file line number Diff line number Diff line change @@ -29,16 +29,13 @@ const vuePageDesigner = {
29
29
store,
30
30
props : {
31
31
value : Object ,
32
- widgets : Object ,
33
- widgetStyle : Object
32
+ widgets : Object
34
33
} ,
35
34
components : { App } ,
36
35
created ( ) {
37
36
// 注册 widgets
38
- // TODO: 合并 widgets 和 widgetStyle
39
37
Vue . use ( widget , {
40
- widgets : this . widgets ,
41
- widgetStyle : this . widgetStyle
38
+ widgets : this . widgets
42
39
} )
43
40
// 初始化已有数据
44
41
if ( this . value ) {
Original file line number Diff line number Diff line change 1
1
// 注册 内置 widgets
2
- import * as inner from '../widgets'
2
+ import inner from '../widgets'
3
3
4
- var widgets , widgetStyle
4
+ var widgets
5
+ var widgetStyle = { }
5
6
6
7
const install = ( Vue , config = { } ) => {
7
8
if ( install . installed ) return
8
9
9
- widgets = Object . assign ( { } , inner . widgets , config . widgets )
10
- widgetStyle = Object . assign ( { } , inner . widgetStyle , config . widgetStyle )
10
+ widgets = Object . assign ( { } , inner , config . widgets )
11
11
12
12
Object . keys ( widgets ) . forEach ( key => {
13
13
Vue . component ( key , widgets [ key ] )
14
- } )
15
- Object . keys ( widgetStyle ) . forEach ( key => {
16
- Vue . component ( key , widgetStyle [ key ] )
14
+ // style panel
15
+ let panel = Object . assign ( { } , widgets [ key ] [ 'panel' ] )
16
+ Vue . component ( panel . name , panel )
17
+ widgetStyle [ panel . name ] = panel
18
+ // remove panel from object
19
+ delete widgets [ key ] [ 'panel' ]
17
20
} )
18
21
}
19
22
Original file line number Diff line number Diff line change 39
39
</template >
40
40
41
41
<script >
42
+ import stylec from ' ./style.vue'
43
+
42
44
export default {
43
45
name: ' braid-container' ,
44
46
icon: ' layout' ,
45
47
title: ' 容器' ,
48
+ panel: stylec,
46
49
setting: {
47
50
type: ' braid-container' ,
48
51
hasGuide: true ,
Original file line number Diff line number Diff line change 1
1
import braidContainer from './container/index.vue'
2
- import braidContainerStyle from './container/style.vue'
3
2
4
- export const widgets = {
3
+ export default {
5
4
braidContainer
6
5
}
7
-
8
- export const widgetStyle = {
9
- braidContainerStyle
10
- }
You can’t perform that action at this time.
0 commit comments