You can use a textarea
with a computed property (with getter and setter) as v-model
.(您可以将具有计算属性(带有getter和setter)的textarea
用作v-model
。)
Something like this:(像这样:)
<textarea v-model="my_JSON_model"></textarea>
<script>
export default {
data() {
return {
my_JSON: {} // import here your json
}
},
computed: {
my_JSON_model: {
get() {
return JSON.stringify( this.my_JSON , null , '' )
},
set(val) {
this.my_JSON = JSON.parse(val);
}
}
}
}
</script>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…