Skip to content

Commit a66c042

Browse files
author
F-loat
committed
fix: use config.initialValue initialize F-loat#44
1 parent f5a3c2c commit a66c042

File tree

4 files changed

+16
-8
lines changed

4 files changed

+16
-8
lines changed

dist/vue-simplemde.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -698,12 +698,16 @@ module.exports = function normalizeComponent (
698698

699699
methods: {
700700
initialize: function initialize() {
701-
var configs = {
701+
var configs = Object.assign({
702702
element: this.$el.firstElementChild,
703703
initialValue: this.value,
704704
renderingConfig: {}
705-
};
706-
Object.assign(configs, this.configs);
705+
}, this.configs);
706+
707+
// 同步 value 和 initialValue 的值
708+
if (configs.initialValue) {
709+
this.$emit('input', configs.initialValue);
710+
}
707711

708712
// 判断是否开启代码高亮
709713
if (this.highlight) {

dist/vue-simplemde.min.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.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-simplemde",
3-
"version": "0.4.6",
3+
"version": "0.4.8",
44
"description": "SimpleMDE - Markdown Editor component for Vue.js",
55
"main": "dist/vue-simplemde.min.js",
66
"scripts": {

src/markdown-editor.vue

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,16 @@ export default {
4949
},
5050
methods: {
5151
initialize() {
52-
const configs = {
52+
const configs = Object.assign({
5353
element: this.$el.firstElementChild,
5454
initialValue: this.value,
5555
renderingConfig: {},
56-
};
57-
Object.assign(configs, this.configs);
56+
}, this.configs);
57+
58+
// 同步 value 和 initialValue 的值
59+
if (configs.initialValue) {
60+
this.$emit('input', configs.initialValue);
61+
}
5862
5963
// 判断是否开启代码高亮
6064
if (this.highlight) {

0 commit comments

Comments
 (0)