Commit 0bf1d9e 1 parent 05c56f8 commit 0bf1d9e Copy full SHA for 0bf1d9e
File tree 5 files changed +18
-9
lines changed
5 files changed +18
-9
lines changed Original file line number Diff line number Diff line change 11
11
outline : none;
12
12
}
13
13
</ style >
14
+ < script src ="https://code.createjs.com/1.0.0/createjs.min.js "> </ script >
14
15
</ head >
15
16
< body >
16
17
< noscript >
Original file line number Diff line number Diff line change 1
1
import ShortcutButton from './shortcut-button'
2
+ import LoadNpmPlugins from './load-npm-plugins.vue'
2
3
import langMixin from '@/mixins/i18n'
3
4
export default {
4
5
mixins : [ langMixin ] ,
@@ -12,6 +13,9 @@ export default {
12
13
type : Function
13
14
}
14
15
} ,
16
+ data : ( ) => ( {
17
+ npmPackages : [ ]
18
+ } ) ,
15
19
methods : {
16
20
onClickShortcut ( item ) {
17
21
if ( this . handleClickShortcut ) {
@@ -89,7 +93,7 @@ export default {
89
93
return (
90
94
< a-row gutter = { 20 } >
91
95
{
92
- this . pluginsList . filter ( plugin => plugin . visible ) . map ( plugin => (
96
+ [ ] . concat ( this . pluginsList , this . npmPackages ) . filter ( plugin => plugin . visible ) . map ( plugin => (
93
97
< a-col span = { 12 } style = { { marginTop : '10px' } } >
94
98
< ShortcutButton
95
99
clickFn = { this . onClickShortcut . bind ( this , plugin ) }
@@ -101,6 +105,9 @@ export default {
101
105
</ a-col >
102
106
) )
103
107
}
108
+ < LoadNpmPlugins onLoadComplete = { npmPackages => {
109
+ this . npmPackages = npmPackages
110
+ } } />
104
111
</ a-row >
105
112
)
106
113
}
Original file line number Diff line number Diff line change @@ -31,15 +31,17 @@ class Element {
31
31
* 3. 为何需要 clone,因为会有 element.clone() 以及 page.clone(),
32
32
* element.pluginProps 和 elementcommonStyle 是引用类型,如果不做 deep_clone 可能会出现意外错误
33
33
*/
34
- this . pluginProps = ( typeof ele . pluginProps === 'object' && cloneObj ( ele . pluginProps ) ) || this . getDefaultPluginProps ( ele . editorConfig || { } )
34
+ this . pluginProps = ( typeof ele . pluginProps === 'object' && cloneObj ( { ... ele . pluginProps , uuid : this . uuid } ) ) || this . getDefaultPluginProps ( ele . editorConfig || { } )
35
35
this . commonStyle = ( typeof ele . commonStyle === 'object' && cloneObj ( ele . commonStyle ) ) || { ...defaultStyle , zindex : ele . zindex }
36
36
this . events = [ ]
37
37
this . animations = ele . animations || [ ]
38
38
}
39
39
40
40
// init prop of plugin
41
41
getDefaultPluginProps ( propsConfig ) {
42
- const pluginProps = { }
42
+ const pluginProps = {
43
+ uuid : this . uuid
44
+ }
43
45
Object . keys ( propsConfig ) . forEach ( key => {
44
46
// #6
45
47
if ( key === 'name' ) {
Original file line number Diff line number Diff line change 1
1
import LbpFormRadio from './lbp-form-radio.js'
2
- import { genUUID } from '../../utils/element.js'
3
2
4
3
const defaultItems = [
5
4
{
@@ -21,7 +20,7 @@ export default {
21
20
props : {
22
21
aliasName : {
23
22
type : String ,
24
- default : `标题演示- ${ genUUID ( ) . slice ( 0 , 6 ) } ` ,
23
+ default : `标题演示` ,
25
24
editor : {
26
25
type : 'a-input' ,
27
26
label : '填写标题' ,
@@ -110,15 +109,15 @@ export default {
110
109
render ( ) {
111
110
return (
112
111
< div >
113
- < h3 > { this . aliasName } { this . type } </ h3 >
112
+ < h3 > { this . aliasName } </ h3 >
114
113
< input type = "text" hidden value = { this . value_ } data-type = "lbp-form-input" data-uuid = { this . uuid } />
115
114
{
116
115
this . items . map ( item => (
117
116
< lbp-form-radio
118
117
vertical
119
118
value = { item . value }
120
119
checked = { this . type === 'radio' ? this . value === item . value : this . value . includes ( item . value ) }
121
- aliasName = { this . aliasName }
120
+ aliasName = { this . uuid }
122
121
type = { this . type }
123
122
onChange = { this . onChange }
124
123
> { item . value } </ lbp-form-radio >
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ export default {
18
18
props : {
19
19
aliasName : {
20
20
type : String ,
21
- default : `标题演示- ${ genUUID ( ) . slice ( 0 , 6 ) } ` ,
21
+ default : `标题演示` ,
22
22
editor : {
23
23
type : 'a-input' ,
24
24
label : '填写标题' ,
@@ -115,7 +115,7 @@ export default {
115
115
vertical
116
116
value = { item . value }
117
117
checked = { this . value === item . value }
118
- aliasName = { this . aliasName }
118
+ aliasName = { this . uuid }
119
119
type = { this . type }
120
120
onChange = { this . onChange }
121
121
> { item . value }
You can’t perform that action at this time.
0 commit comments