@maxelms/create-plugin-cli 1.1.28 → 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 +11 -10
- package/templates/vue3-micro-field/src/main.js +1 -1
- package/templates/vue3-micro-plugin/src/App.vue.tpl +5 -11
- 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 +16 -10
- 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,12 +24,19 @@ 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: {
|
|
36
|
+
updateMasterProps(newProps) {
|
|
37
|
+
// 更新本地数据,触发响应式更新
|
|
38
|
+
Object.assign(this.masterProps, newProps);
|
|
39
|
+
},
|
|
33
40
|
change(e) {
|
|
34
41
|
this.onChange && this.onChange({
|
|
35
42
|
text: null,
|
|
@@ -38,12 +45,6 @@ export default {
|
|
|
38
45
|
}
|
|
39
46
|
},
|
|
40
47
|
computed: {
|
|
41
|
-
updateMasterProps(newProps) {
|
|
42
|
-
// 更新本地数据,这会触发响应式更新
|
|
43
|
-
this.localMasterProps = { ...newProps };
|
|
44
|
-
// 同时触发事件通知父组件
|
|
45
|
-
this.$emit('update:masterProps', newProps);
|
|
46
|
-
},
|
|
47
48
|
/** value、onChange 是属性组件作为表单受控组件的必要属性 */
|
|
48
49
|
value () {
|
|
49
50
|
return this.masterProps?.value?.value || "欢迎使用 Maxelms 属性组件"
|
|
@@ -20,23 +20,17 @@ 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
|
-
|
|
32
|
-
},
|
|
33
|
-
computed: {
|
|
34
28
|
updateMasterProps(newProps) {
|
|
35
|
-
//
|
|
36
|
-
this.
|
|
37
|
-
// 同时触发事件通知父组件
|
|
38
|
-
this.$emit('update:masterProps', newProps);
|
|
29
|
+
// 更新本地数据,触发响应式更新
|
|
30
|
+
Object.assign(this.masterProps, newProps);
|
|
39
31
|
},
|
|
32
|
+
},
|
|
33
|
+
computed: {
|
|
40
34
|
/** 是否禁用 */
|
|
41
35
|
disabled () {
|
|
42
36
|
return this.masterProps?.configurations?.propName3
|
|
@@ -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,27 +17,33 @@ export default {
|
|
|
17
17
|
name: 'App',
|
|
18
18
|
components: {
|
|
19
19
|
},
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
props: {
|
|
21
|
+
mainProps: {}
|
|
22
22
|
},
|
|
23
|
-
|
|
23
|
+
data() {
|
|
24
|
+
return {
|
|
25
|
+
masterProps: { ...this.mainProps }
|
|
26
|
+
};
|
|
27
|
+
},
|
|
28
|
+
methods: {
|
|
29
|
+
// 正确的方法来更新 masterProps
|
|
24
30
|
updateMasterProps(newProps) {
|
|
25
|
-
//
|
|
26
|
-
this.
|
|
27
|
-
// 同时触发事件通知父组件
|
|
28
|
-
this.$emit('update:masterProps', newProps);
|
|
31
|
+
// 更新本地数据,触发响应式更新
|
|
32
|
+
Object.assign(this.masterProps, newProps);
|
|
29
33
|
},
|
|
34
|
+
},
|
|
35
|
+
computed: {
|
|
30
36
|
/** 是否禁用 */
|
|
31
37
|
disabled () {
|
|
32
|
-
return this
|
|
38
|
+
return this.masterProps?.configurations?.propName3
|
|
33
39
|
},
|
|
34
40
|
/** 控件宽度 */
|
|
35
41
|
width () {
|
|
36
|
-
return this
|
|
42
|
+
return this.masterProps?.configurations?.propName2 || 350
|
|
37
43
|
},
|
|
38
44
|
/** 提示文本 */
|
|
39
45
|
placeholder () {
|
|
40
|
-
return this
|
|
46
|
+
return this.masterProps?.configurations?.propName1
|
|
41
47
|
},
|
|
42
48
|
},
|
|
43
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')
|