Commit 1070215 1 parent cf70307 commit 1070215 Copy full SHA for 1070215
File tree 3 files changed +17
-5
lines changed
3 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -148,11 +148,16 @@ export default {
148
148
* !#zh 点击插件,copy 其基础数据到组件树(中间画布)
149
149
* #!en click the plugin shortcut, create new Element with the plugin's meta data
150
150
* pluginInfo {Object}: 插件列表中的基础数据, {name}=pluginInfo
151
+ *
152
+ * shortcutItem: PluginListItem = {
153
+ name: String,
154
+ shortcutProps: {}
155
+ }
151
156
*/
152
- clone ( { name } ) {
157
+ clone ( shortcutItem ) {
153
158
this . elementManager ( {
154
159
type : 'add' ,
155
- value : { name }
160
+ value : shortcutItem
156
161
} )
157
162
} ,
158
163
/**
Original file line number Diff line number Diff line change @@ -53,12 +53,12 @@ class Element {
53
53
if ( typeof ele . pluginProps === 'object' ) {
54
54
return cloneObj ( { ...ele . pluginProps , uuid : this . uuid } )
55
55
}
56
- return this . getDefaultPluginProps ( ele . props || { } )
56
+ return this . getDefaultPluginProps ( ele . props , ele . shortcutProps )
57
57
}
58
58
59
59
// init prop of plugin
60
- getDefaultPluginProps ( props ) {
61
- const pluginProps = {
60
+ getDefaultPluginProps ( props = { } , shortcutProps ) {
61
+ let pluginProps = {
62
62
uuid : this . uuid
63
63
}
64
64
Object . keys ( props ) . forEach ( key => {
@@ -70,6 +70,12 @@ class Element {
70
70
const defaultValue = props [ key ] . default
71
71
pluginProps [ key ] = typeof defaultValue === 'function' ? defaultValue ( ) : defaultValue
72
72
} )
73
+
74
+ pluginProps = {
75
+ ...pluginProps ,
76
+ ...shortcutProps
77
+ }
78
+
73
79
return pluginProps
74
80
}
75
81
Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ export const mutations = {
40
40
switch ( type ) {
41
41
case 'add' :
42
42
const vm = getVM ( value . name )
43
+ vm . $options . shortcutProps = value . shortcutProps
43
44
const element = new Element ( vm . $options )
44
45
elements . push ( element )
45
46
break
You can’t perform that action at this time.
0 commit comments