edit-wrapper 1.1.2 → 1.1.6
Sign up to get free protection for your applications and to get access to all the features.
package/package.json
CHANGED
package/src/components/Main.vue
CHANGED
@@ -5,8 +5,8 @@
|
|
5
5
|
<label v-for="(item, index) in typesArr" for="r5" :key="index" ><input @change="changeRadio" :id="index" type="radio" name="type" :value="item.value">{{item.label}}</label>
|
6
6
|
</div>
|
7
7
|
</div>
|
8
|
-
|
9
|
-
<monaco-editor width="800" height="600" :language="language" :key="randomKey" :code="code" />
|
8
|
+
|
9
|
+
<monaco-editor width="800" height="600" :language="language" :key="randomKey" :code="code" @onCodeChange="onCodeChange" />
|
10
10
|
</div>
|
11
11
|
</template>
|
12
12
|
|
@@ -31,15 +31,20 @@ export default {
|
|
31
31
|
],
|
32
32
|
randomKey: 1,
|
33
33
|
language: 'text',
|
34
|
-
code: "
|
34
|
+
code: "",
|
35
35
|
editor: ""
|
36
36
|
};
|
37
37
|
},
|
38
38
|
methods: {
|
39
39
|
changeRadio(e) {
|
40
|
+
console.log("code", this.code);
|
40
41
|
this.language = e.target.value
|
41
42
|
this.randomKey = Date.now()
|
42
43
|
},
|
44
|
+
onCodeChange(editor) {
|
45
|
+
console.log(editor.getValue());
|
46
|
+
this.code = editor.getValue()
|
47
|
+
}
|
43
48
|
}
|
44
49
|
};
|
45
50
|
</script>
|
@@ -10,7 +10,7 @@ module.exports = {
|
|
10
10
|
props: {
|
11
11
|
width: { type: [String, Number], default: '100%' },
|
12
12
|
height: { type: [String, Number], default: '100%' },
|
13
|
-
code: { type: String, default: '
|
13
|
+
code: { type: String, default: '' },
|
14
14
|
srcPath: { type: String },
|
15
15
|
language: { type: String, default: 'javascript' },
|
16
16
|
theme: { type: String, default: 'vs-dark' }, // vs, hc-black
|
@@ -22,7 +22,9 @@ module.exports = {
|
|
22
22
|
changeThrottle: { type: Number, default: 0 }
|
23
23
|
},
|
24
24
|
mounted() {
|
25
|
-
|
25
|
+
setTimeout(() => {
|
26
|
+
this.fetchEditor();
|
27
|
+
}, 0)
|
26
28
|
},
|
27
29
|
destroyed() {
|
28
30
|
this.destroyMonaco();
|