zydx-plus 1.30.148 → 1.30.149

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": "zydx-plus",
3
- "version": "1.30.148",
3
+ "version": "1.30.149",
4
4
  "description": "Vue.js",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -80,6 +80,10 @@ export default {
80
80
  }
81
81
  },
82
82
  props: {
83
+ data: {
84
+ type: Object,
85
+ default: () => {}
86
+ },
83
87
  width: {
84
88
  type: Number,
85
89
  default: 800
@@ -90,6 +94,14 @@ export default {
90
94
  }
91
95
  },
92
96
  emits: ['save'],
97
+ watch: {
98
+ data: {
99
+ handler(val) {
100
+ this.canvas.loadFromJSON(val)
101
+ },
102
+ deep: true
103
+ }
104
+ },
93
105
  mounted() {
94
106
  this.init()
95
107
  window.addEventListener('keydown', this.handleKeyEvent)
@@ -123,7 +135,7 @@ export default {
123
135
  height: this.height,
124
136
  });
125
137
  this.canvas.selectionColor = "rgba(255,255,255,0)";
126
- // this.canvas.loadFromJSON(v)
138
+ this.canvas.loadFromJSON(this.data)
127
139
  },
128
140
  // 画笔
129
141
  brush() {
@@ -319,6 +331,7 @@ export default {
319
331
  this.canvas.add(this.textbox)
320
332
  },
321
333
  save() {
334
+ console.log(this.canvas.toJSON())
322
335
  this.$emit('save', this.canvas.toJSON())
323
336
  },
324
337
  clear() {
package/src/index.js CHANGED
@@ -71,7 +71,7 @@ function install(app) {
71
71
  }
72
72
 
73
73
  export default {
74
- version: '1.30.148',
74
+ version: '1.30.149',
75
75
  install,
76
76
  Calendar,
77
77
  Message,