什么用
定义snippets的时候用
比如
vscode怎么拼
把
<template lang="">
<div>
{{ msg }}
<input type="button" @click="handleClick" value="点我">
</div>
</template>
<script>
export default {
data() {
return {
msg: "hello billy",
};
},
methods: {
handleClick() {
alert('handleClick')
},
},
watch: {
msg(newValue, oldValue) {
},
},
computed: {
name() {
return this.msg;
},
},
};
</script>
<style lang="">
</style>
变成
"<template lang="">"+
" <div>"+
" {{ msg }}"+
" <input type="button" @click="handleClick" value="点我">"+
" </div>"+
"</template>"+
"<script>"+
"export default {"+
" data() {"+
" return {"+
" msg: \"hello billy\","+
" };"+
" },"+
" methods: {"+
" handleClick() {"+
" alert('handleClick')"+
" },"+
" },"+
" watch: {"+
" msg(newValue, oldValue) {"+
" "+
" },"+
" },"+
" computed: {"+
" name() {"+
" return this.msg;"+
" },"+
" },"+
"};"+
"<\/script>"+
"<style lang=\"\">"+
""+
"</style>"
怎么变
新建一个文件,进行两步正则替换
替换首
替换尾
再做加一些转义字符串微调
当然
在webstorm中
var str = “粘贴想要粘贴的内容”,他会自动帮你转
不想单独创建一个文件,可以"在选定内容中查找"
如果有其他更好的方式就好了,我觉得已经挺好的了