@maxelms/create-plugin-cli 1.1.29 → 1.1.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/templates/vue3-micro-button/src/App.vue.tpl +5 -9
- package/templates/vue3-micro-button/src/main.js +1 -1
- package/templates/vue3-micro-field/src/App.vue.tpl +9 -8
- package/templates/vue3-micro-field/src/main.js +1 -1
- package/templates/vue3-micro-plugin/src/App.vue.tpl +4 -9
- package/templates/vue3-micro-plugin/src/main.js +1 -1
- package/templates/vue3vite-micro-button/src/App.vue.tpl +8 -5
- package/templates/vue3vite-micro-button/src/main.ts +1 -2
- package/templates/vue3vite-micro-plugin/src/App.vue.tpl +15 -8
- package/templates/vue3vite-micro-plugin/src/main.ts +1 -1
package/package.json
CHANGED
|
@@ -16,16 +16,14 @@ if (process.env.NODE_ENV === 'development') {
|
|
|
16
16
|
|
|
17
17
|
export default {
|
|
18
18
|
name: 'App',
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
type: Object,
|
|
22
|
-
default: () => ({})
|
|
23
|
-
}
|
|
19
|
+
props: {
|
|
20
|
+
mainProps: {}
|
|
24
21
|
},
|
|
25
22
|
data() {
|
|
26
23
|
return {
|
|
24
|
+
masterProps: { ...this.mainProps },
|
|
27
25
|
visible: false,
|
|
28
|
-
buttonName: this.
|
|
26
|
+
buttonName: this.mainProps?.originalButtonProps?.name,
|
|
29
27
|
}
|
|
30
28
|
},
|
|
31
29
|
components: {
|
|
@@ -34,9 +32,7 @@ export default {
|
|
|
34
32
|
methods: {
|
|
35
33
|
updateMasterProps(newProps) {
|
|
36
34
|
// 更新本地数据,这会触发响应式更新
|
|
37
|
-
this.
|
|
38
|
-
// 同时触发事件通知父组件
|
|
39
|
-
this.$emit('update:masterProps', newProps);
|
|
35
|
+
Object.assign(this.masterProps, newProps);
|
|
40
36
|
},
|
|
41
37
|
},
|
|
42
38
|
created() {
|
|
@@ -24,17 +24,18 @@ export default {
|
|
|
24
24
|
components: {
|
|
25
25
|
},
|
|
26
26
|
props: {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
mainProps: {}
|
|
28
|
+
},
|
|
29
|
+
data() {
|
|
30
|
+
return {
|
|
31
|
+
// 本地存储可变的 masterProps
|
|
32
|
+
masterProps: { ...this.mainProps }
|
|
33
|
+
};
|
|
31
34
|
},
|
|
32
35
|
methods: {
|
|
33
36
|
updateMasterProps(newProps) {
|
|
34
|
-
//
|
|
35
|
-
this.
|
|
36
|
-
// 同时触发事件通知父组件
|
|
37
|
-
this.$emit('update:masterProps', newProps);
|
|
37
|
+
// 更新本地数据,触发响应式更新
|
|
38
|
+
Object.assign(this.masterProps, newProps);
|
|
38
39
|
},
|
|
39
40
|
change(e) {
|
|
40
41
|
this.onChange && this.onChange({
|
|
@@ -20,20 +20,15 @@ if (process.env.NODE_ENV === 'development') {
|
|
|
20
20
|
export default {
|
|
21
21
|
name: 'App',
|
|
22
22
|
props: {
|
|
23
|
-
|
|
24
|
-
type: Object,
|
|
25
|
-
default: () => ({})
|
|
26
|
-
}
|
|
23
|
+
mainProps: {}
|
|
27
24
|
},
|
|
28
25
|
components: {
|
|
29
26
|
},
|
|
30
27
|
methods: {
|
|
31
28
|
updateMasterProps(newProps) {
|
|
32
|
-
//
|
|
33
|
-
this.
|
|
34
|
-
|
|
35
|
-
this.$emit('update:masterProps', newProps);
|
|
36
|
-
}
|
|
29
|
+
// 更新本地数据,触发响应式更新
|
|
30
|
+
Object.assign(this.masterProps, newProps);
|
|
31
|
+
},
|
|
37
32
|
},
|
|
38
33
|
computed: {
|
|
39
34
|
/** 是否禁用 */
|
|
@@ -12,21 +12,24 @@
|
|
|
12
12
|
|
|
13
13
|
export default {
|
|
14
14
|
name: 'App',
|
|
15
|
+
props: {
|
|
16
|
+
mainProps: {}
|
|
17
|
+
},
|
|
15
18
|
data() {
|
|
16
19
|
return {
|
|
20
|
+
masterProps: { ...this.mainProps }
|
|
17
21
|
visible: false,
|
|
18
|
-
buttonName: this
|
|
22
|
+
buttonName: this.mainProps?.originalButtonProps?.name,
|
|
19
23
|
}
|
|
20
24
|
},
|
|
21
25
|
components: {
|
|
22
26
|
|
|
23
27
|
},
|
|
24
28
|
methods: {
|
|
29
|
+
// 正确的方法来更新 masterProps
|
|
25
30
|
updateMasterProps(newProps) {
|
|
26
|
-
//
|
|
27
|
-
this.
|
|
28
|
-
// 同时触发事件通知父组件
|
|
29
|
-
this.$emit('update:masterProps', newProps);
|
|
31
|
+
// 更新本地数据,触发响应式更新
|
|
32
|
+
Object.assign(this.masterProps, newProps);
|
|
30
33
|
},
|
|
31
34
|
},
|
|
32
35
|
created() {
|
|
@@ -30,9 +30,8 @@ if (poweredByMaxelms && registerPlugin) {
|
|
|
30
30
|
|
|
31
31
|
function render(props: any = {}) {
|
|
32
32
|
const { containerId } = props
|
|
33
|
-
console.log(containerId)
|
|
34
33
|
vms[containerId] = createApp(App, {
|
|
35
|
-
|
|
34
|
+
mainProps: props || {}
|
|
36
35
|
})
|
|
37
36
|
vms[containerId].use(createPinia())
|
|
38
37
|
vms[containerId].mount(containerId ? `#${containerId} #micro-app` : '#micro-app')
|
|
@@ -17,26 +17,33 @@ export default {
|
|
|
17
17
|
name: 'App',
|
|
18
18
|
components: {
|
|
19
19
|
},
|
|
20
|
+
props: {
|
|
21
|
+
mainProps: {}
|
|
22
|
+
},
|
|
23
|
+
data() {
|
|
24
|
+
return {
|
|
25
|
+
masterProps: { ...this.mainProps }
|
|
26
|
+
};
|
|
27
|
+
},
|
|
20
28
|
methods: {
|
|
29
|
+
// 正确的方法来更新 masterProps
|
|
21
30
|
updateMasterProps(newProps) {
|
|
22
|
-
//
|
|
23
|
-
this.
|
|
24
|
-
|
|
25
|
-
this.$emit('update:masterProps', newProps);
|
|
26
|
-
}
|
|
31
|
+
// 更新本地数据,触发响应式更新
|
|
32
|
+
Object.assign(this.masterProps, newProps);
|
|
33
|
+
},
|
|
27
34
|
},
|
|
28
35
|
computed: {
|
|
29
36
|
/** 是否禁用 */
|
|
30
37
|
disabled () {
|
|
31
|
-
return this
|
|
38
|
+
return this.masterProps?.configurations?.propName3
|
|
32
39
|
},
|
|
33
40
|
/** 控件宽度 */
|
|
34
41
|
width () {
|
|
35
|
-
return this
|
|
42
|
+
return this.masterProps?.configurations?.propName2 || 350
|
|
36
43
|
},
|
|
37
44
|
/** 提示文本 */
|
|
38
45
|
placeholder () {
|
|
39
|
-
return this
|
|
46
|
+
return this.masterProps?.configurations?.propName1
|
|
40
47
|
},
|
|
41
48
|
},
|
|
42
49
|
}
|
|
@@ -32,7 +32,7 @@ function render(props: any = {}) {
|
|
|
32
32
|
const { containerId } = props
|
|
33
33
|
console.log(containerId)
|
|
34
34
|
vms[containerId] = createApp(App, {
|
|
35
|
-
|
|
35
|
+
mainProps: props || {},
|
|
36
36
|
})
|
|
37
37
|
vms[containerId].use(createPinia())
|
|
38
38
|
vms[containerId].mount(containerId ? `#${containerId} #micro-app` : '#micro-app')
|