Skip to content

Commit 921711f

Browse files
committed
fix: F-loat#70 update content variable after toTextArea()
1 parent 0a28d62 commit 921711f

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/index.vue

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
<template>
22
<div class="vue-simplemde">
3-
<textarea :name="name"></textarea>
3+
<textarea
4+
class="vue-simplemde-textarea"
5+
:name="name"
6+
:value="modelVal"
7+
@input="handleInput"
8+
/>
49
</div>
510
</template>
611

@@ -39,6 +44,11 @@ export default {
3944
},
4045
},
4146
},
47+
data() {
48+
return {
49+
modelVal: '',
50+
};
51+
},
4252
mounted() {
4353
if (this.autoinit) this.initialize();
4454
},
@@ -91,6 +101,9 @@ export default {
91101
preview.className = `editor-preview ${className}`;
92102
wrapper.appendChild(preview);
93103
},
104+
handleInput(e) {
105+
this.$emit('input', e.target.value);
106+
},
94107
},
95108
destroyed() {
96109
this.simplemde = null;
@@ -99,6 +112,7 @@ export default {
99112
value(val) {
100113
if (val === this.simplemde.value()) return;
101114
this.simplemde.value(val);
115+
this.modelVal = val;
102116
},
103117
},
104118
};

0 commit comments

Comments
 (0)