Skip to content

Commit cac1565

Browse files
committed
修复 WangEditor 默认值问题
1 parent a7cdf76 commit cac1565

File tree

9 files changed

+181
-152
lines changed

9 files changed

+181
-152
lines changed

package-lock.json

Lines changed: 146 additions & 113 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,31 @@
1616
"babel-plugin-component": "^1.1.1",
1717
"babel-plugin-import": "^1.13.0",
1818
"cross-env": "^5.1",
19-
"element-ui": "^2.13.0",
19+
"element-ui": "^2.13.2",
2020
"laravel-mix": "^4.1.4",
2121
"lodash": "^4.17.15",
22-
"popper.js": "^1.12",
22+
"popper.js": "^1.16.1",
2323
"resolve-url-loader": "^2.3.1",
24-
"sass": "^1.20.1",
24+
"sass": "^1.26.8",
2525
"sass-loader": "7.*",
2626
"vue": "^2.6.11",
2727
"vue-bus": "^1.2.1",
2828
"vue-clipboard2": "^0.3.1",
2929
"vue-dplayer": "0.0.10",
3030
"vue-happy-scroll": "^2.1.1",
31-
"vue-router": "^3.1.6",
31+
"vue-router": "^3.3.2",
3232
"vue-template-compiler": "^2.6.10",
3333
"vue-waterfall2": "^1.9.6",
3434
"wangeditor": "^3.1.1"
3535
},
3636
"dependencies": {
37-
"@antv/g2plot": "^1.0.2",
37+
"@antv/g2plot": "^1.1.6",
3838
"awe-dnd": "^0.3.4",
3939
"babel-plugin-dynamic-import-webpack": "^1.1.0",
4040
"babel-plugin-syntax-dynamic-import": "^6.18.0",
4141
"nprogress": "^0.2.0",
4242
"url-loader": "^3.0.0",
4343
"vue-nprogress": "^0.1.5",
44-
"vuex": "^3.1.3"
44+
"vuex": "^3.4.0"
4545
}
4646
}

public/0.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/3.js

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ __webpack_require__.r(__webpack_exports__);
2020
//
2121
//
2222
//
23+
//
24+
//
25+
//
26+
//
2327

2428
/* harmony default export */ __webpack_exports__["default"] = ({
2529
props: ["value", "attrs", "form_data", "form_items"],
@@ -37,7 +41,7 @@ __webpack_require__.r(__webpack_exports__);
3741
mounted: function mounted() {
3842
var _this = this;
3943

40-
this.defaultValue = this._.cloneDeep(this.value);
44+
this.defaultValue = this._.cloneDeep(this.attrs.componentValue);
4145
this.editor = new wangeditor__WEBPACK_IMPORTED_MODULE_0___default.a(this.$refs.toolbar, this.$refs.editor);
4246
this.editor.customConfig.menus = this.attrs.menus;
4347
this.editor.customConfig.zIndex = this.attrs.zIndex;
@@ -60,24 +64,16 @@ __webpack_require__.r(__webpack_exports__);
6064
this.editor.customConfig.uploadImgHeaders = this.attrs.uploadImgHeaders;
6165
}
6266

63-
this.editor.customConfig.onchange = function (html) {
64-
_this.onChange(html);
65-
};
66-
6767
this.$nextTick(function () {
6868
_this.editor.create();
6969

7070
_this.editor.txt.html(_this.defaultValue);
71+
72+
_this.editor.customConfig.onchange = function (html) {
73+
_this.onChange(html);
74+
};
7175
});
7276
},
73-
watch: {
74-
value: function value(html) {
75-
if (!this.initHtml) {
76-
this.initHtml = true;
77-
this.editor.txt.html(html);
78-
}
79-
}
80-
},
8177
methods: {
8278
onChange: function onChange(value) {
8379
this.$emit("change", value);

public/6.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/app.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/mix-manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"/app.js": "/app.js?id=44b53029cb7cbb645934",
2+
"/app.js": "/app.js?id=bac12be78a7b572195b9",
33
"/manifest.js": "/manifest.js?id=8991394a854ee5cdffc3",
4-
"/vendor.js": "/vendor.js?id=159feaa1cb9cfd111212"
4+
"/vendor.js": "/vendor.js?id=f20525ac5ecb92ff064c"
55
}

public/vendor.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/js/components/widgets/Form/WangEditor.vue

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
<template>
22
<div class="wangeditor-main">
33
<div ref="toolbar" class="toolbar"></div>
4-
<div v-if='attrs.component'>
5-
<component :is="attrs.component.componentName" :attrs='attrs.component' :editor.sync='editor' />
4+
<div v-if="attrs.component">
5+
<component
6+
:is="attrs.component.componentName"
7+
:attrs="attrs.component"
8+
:editor.sync="editor"
9+
/>
610
</div>
711
<div ref="editor" :style="attrs.style" :class="attrs.className"></div>
812
</div>
@@ -22,8 +26,10 @@ export default {
2226
defaultValue: "",
2327
};
2428
},
29+
2530
mounted() {
26-
this.defaultValue = this._.cloneDeep(this.value);
31+
this.defaultValue = this._.cloneDeep(this.attrs.componentValue);
32+
2733
2834
this.editor = new E(this.$refs.toolbar, this.$refs.editor);
2935
this.editor.customConfig.menus = this.attrs.menus;
@@ -45,21 +51,15 @@ export default {
4551
this.editor.customConfig.uploadImgHeaders = this.attrs.uploadImgHeaders;
4652
}
4753
48-
this.editor.customConfig.onchange = (html) => {
49-
this.onChange(html);
50-
};
5154
this.$nextTick(() => {
5255
this.editor.create();
5356
this.editor.txt.html(this.defaultValue);
57+
58+
this.editor.customConfig.onchange = (html) => {
59+
this.onChange(html);
60+
};
5461
});
55-
},
56-
watch: {
57-
value(html) {
58-
if (!this.initHtml) {
59-
this.initHtml = true;
60-
this.editor.txt.html(html);
61-
}
62-
},
62+
6363
},
6464
methods: {
6565
onChange(value) {

0 commit comments

Comments
 (0)