@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maxelms/create-plugin-cli",
3
- "version": "1.1.29",
3
+ "version": "1.1.30",
4
4
  "main": "./bin/index.js",
5
5
  "author": "jackc_001",
6
6
  "bin": {
@@ -16,16 +16,14 @@ if (process.env.NODE_ENV === 'development') {
16
16
 
17
17
  export default {
18
18
  name: 'App',
19
- props: {
20
- masterProps: {
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.masterProps?.originalButtonProps?.name,
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.localMasterProps = { ...newProps };
38
- // 同时触发事件通知父组件
39
- this.$emit('update:masterProps', newProps);
35
+ Object.assign(this.masterProps, newProps);
40
36
  },
41
37
  },
42
38
  created() {
@@ -15,7 +15,7 @@ const vms = {}
15
15
  const render = (props) => {
16
16
  const { containerId } = props || {}
17
17
  vms[containerId] = createApp(App, {
18
- masterProps: props || {}
18
+ mainProps: props || {}
19
19
  }).mount(containerId ? `#${containerId} #root` : '#root');
20
20
  }
21
21
 
@@ -24,17 +24,18 @@ export default {
24
24
  components: {
25
25
  },
26
26
  props: {
27
- masterProps: {
28
- type: Object,
29
- default: () => ({})
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.localMasterProps = { ...newProps };
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({
@@ -15,7 +15,7 @@ const vms = {}
15
15
  const render = (props) => {
16
16
  const { containerId } = props || {}
17
17
  vms[containerId] = createApp(App, {
18
- masterProps: props || {}
18
+ mainProps: props || {}
19
19
  }).mount(containerId ? `#${containerId} #root` : '#root');
20
20
  }
21
21
 
@@ -20,20 +20,15 @@ if (process.env.NODE_ENV === 'development') {
20
20
  export default {
21
21
  name: 'App',
22
22
  props: {
23
- masterProps: {
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.localMasterProps = { ...newProps };
34
- // 同时触发事件通知父组件
35
- this.$emit('update:masterProps', newProps);
36
- }
29
+ // 更新本地数据,触发响应式更新
30
+ Object.assign(this.masterProps, newProps);
31
+ },
37
32
  },
38
33
  computed: {
39
34
  /** 是否禁用 */
@@ -15,7 +15,7 @@ const vms = {}
15
15
  const render = (props) => {
16
16
  const { containerId } = props || {}
17
17
  vms[containerId] = createApp(App, {
18
- masterProps: props || {}
18
+ mainProps: props || {}
19
19
  }).mount(containerId ? `#${containerId} #root` : '#root');
20
20
  }
21
21
 
@@ -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.$root?.masterProps?.originalButtonProps?.name,
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.localMasterProps = { ...newProps };
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
- configurations: props || {},
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.localMasterProps = { ...newProps };
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.$root?.masterProps?.configurations?.propName3
38
+ return this.masterProps?.configurations?.propName3
32
39
  },
33
40
  /** 控件宽度 */
34
41
  width () {
35
- return this.$root?.masterProps?.configurations?.propName2 || 350
42
+ return this.masterProps?.configurations?.propName2 || 350
36
43
  },
37
44
  /** 提示文本 */
38
45
  placeholder () {
39
- return this.$root?.masterProps?.configurations?.propName1
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
- configurations: props || {},
35
+ mainProps: props || {},
36
36
  })
37
37
  vms[containerId].use(createPinia())
38
38
  vms[containerId].mount(containerId ? `#${containerId} #micro-app` : '#micro-app')