@maxelms/create-plugin-cli 1.1.27 → 1.1.29

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maxelms/create-plugin-cli",
3
- "version": "1.1.27",
3
+ "version": "1.1.29",
4
4
  "main": "./bin/index.js",
5
5
  "author": "jackc_001",
6
6
  "bin": {
@@ -29,6 +29,7 @@ if (poweredByMaxelms) {
29
29
  mount(props) {
30
30
  render(props)
31
31
  },
32
+ // 更新指定容器ID的Vue实例的masterProps属性
32
33
  update(props) {
33
34
  if (vms[props.containerId]) {
34
35
  vms[props.containerId].masterProps = props
@@ -32,7 +32,12 @@ export default {
32
32
 
33
33
  },
34
34
  methods: {
35
-
35
+ updateMasterProps(newProps) {
36
+ // 更新本地数据,这会触发响应式更新
37
+ this.localMasterProps = { ...newProps };
38
+ // 同时触发事件通知父组件
39
+ this.$emit('update:masterProps', newProps);
40
+ },
36
41
  },
37
42
  created() {
38
43
  console.log(this.masterProps)
@@ -14,7 +14,7 @@ const vms = {}
14
14
 
15
15
  const render = (props) => {
16
16
  const { containerId } = props || {}
17
- createApp(App, {
17
+ vms[containerId] = createApp(App, {
18
18
  masterProps: props || {}
19
19
  }).mount(containerId ? `#${containerId} #root` : '#root');
20
20
  }
@@ -25,8 +25,8 @@ if (poweredByMaxelms) {
25
25
  render(props)
26
26
  },
27
27
  update(props) {
28
- if (vms[props.containerId]) {
29
- vms[props.containerId].masterProps = props
28
+ if (vms[props.containerId] && vms[props.containerId].updateMasterProps) {
29
+ vms[props.containerId].updateMasterProps(props);
30
30
  }
31
31
  },
32
32
  unmount(props) {
@@ -30,6 +30,12 @@ export default {
30
30
  }
31
31
  },
32
32
  methods: {
33
+ updateMasterProps(newProps) {
34
+ // 更新本地数据,这会触发响应式更新
35
+ this.localMasterProps = { ...newProps };
36
+ // 同时触发事件通知父组件
37
+ this.$emit('update:masterProps', newProps);
38
+ },
33
39
  change(e) {
34
40
  this.onChange && this.onChange({
35
41
  text: null,
@@ -14,7 +14,7 @@ const vms = {}
14
14
 
15
15
  const render = (props) => {
16
16
  const { containerId } = props || {}
17
- createApp(App, {
17
+ vms[containerId] = createApp(App, {
18
18
  masterProps: props || {}
19
19
  }).mount(containerId ? `#${containerId} #root` : '#root');
20
20
  }
@@ -25,8 +25,8 @@ if (poweredByMaxelms) {
25
25
  render(props)
26
26
  },
27
27
  update(props) {
28
- if (vms[props.containerId]) {
29
- vms[props.containerId].masterProps = props
28
+ if (vms[props.containerId] && vms[props.containerId].updateMasterProps) {
29
+ vms[props.containerId].updateMasterProps(props);
30
30
  }
31
31
  },
32
32
  unmount(props) {
@@ -28,7 +28,12 @@ export default {
28
28
  components: {
29
29
  },
30
30
  methods: {
31
-
31
+ updateMasterProps(newProps) {
32
+ // 更新本地数据,这会触发响应式更新
33
+ this.localMasterProps = { ...newProps };
34
+ // 同时触发事件通知父组件
35
+ this.$emit('update:masterProps', newProps);
36
+ }
32
37
  },
33
38
  computed: {
34
39
  /** 是否禁用 */
@@ -14,7 +14,7 @@ const vms = {}
14
14
 
15
15
  const render = (props) => {
16
16
  const { containerId } = props || {}
17
- createApp(App, {
17
+ vms[containerId] = createApp(App, {
18
18
  masterProps: props || {}
19
19
  }).mount(containerId ? `#${containerId} #root` : '#root');
20
20
  }
@@ -25,8 +25,8 @@ if (poweredByMaxelms) {
25
25
  render(props)
26
26
  },
27
27
  update(props) {
28
- if (vms[props.containerId]) {
29
- vms[props.containerId].masterProps = props
28
+ if (vms[props.containerId] && vms[props.containerId].updateMasterProps) {
29
+ vms[props.containerId].updateMasterProps(props);
30
30
  }
31
31
  },
32
32
  unmount(props) {
@@ -22,7 +22,12 @@ export default {
22
22
 
23
23
  },
24
24
  methods: {
25
-
25
+ updateMasterProps(newProps) {
26
+ // 更新本地数据,这会触发响应式更新
27
+ this.localMasterProps = { ...newProps };
28
+ // 同时触发事件通知父组件
29
+ this.$emit('update:masterProps', newProps);
30
+ },
26
31
  },
27
32
  created() {
28
33
 
@@ -15,8 +15,8 @@ if (poweredByMaxelms && registerPlugin) {
15
15
  render(props)
16
16
  },
17
17
  update(props) {
18
- if (vms[props.containerId]) {
19
- vms[props.containerId].masterProps = props
18
+ if (vms[props.containerId] && vms[props.containerId].updateMasterProps) {
19
+ vms[props.containerId].updateMasterProps(props);
20
20
  }
21
21
  },
22
22
  unmount(props) {
@@ -18,7 +18,12 @@ export default {
18
18
  components: {
19
19
  },
20
20
  methods: {
21
-
21
+ updateMasterProps(newProps) {
22
+ // 更新本地数据,这会触发响应式更新
23
+ this.localMasterProps = { ...newProps };
24
+ // 同时触发事件通知父组件
25
+ this.$emit('update:masterProps', newProps);
26
+ }
22
27
  },
23
28
  computed: {
24
29
  /** 是否禁用 */
@@ -15,8 +15,8 @@ if (poweredByMaxelms && registerPlugin) {
15
15
  render(props)
16
16
  },
17
17
  update(props) {
18
- if (vms[props.containerId]) {
19
- vms[props.containerId].masterProps = props
18
+ if (vms[props.containerId] && vms[props.containerId].updateMasterProps) {
19
+ vms[props.containerId].updateMasterProps(props);
20
20
  }
21
21
  },
22
22
  unmount(props) {