vscode中快速⽣成vue3模板, 1.
⾸先在vscode编辑器中
⽂件–>⾸选项–>⽤户代码⽚段–>点击新建代码⽚段–取名vue.json 确定
2.把下列代码放进去
{
"Print to console":{
"prefix":"vue3",
"body":[
"<!-- $0 -->",
"<template>",
" <div></div>",
"</template>",
"",
"<script lang='ts'>",
"import { reactive,toRefs,onBeforeMount,onMounted} from 'vue'",
"interface DataProps {}",
"export default {",
" name: '',",
" setup() {",
" console.log('1-开始创建组件-setup')",
" const data: DataProps = reactive({",
"",
" })",
" onBeforeMount(() => {",
网页模板编辑器" console.log('2.组件挂载页⾯之前执⾏----onBeforeMount')",
" })",
" onMounted(() => {",
" console.log('3.-组件挂载到页⾯之后执⾏-------onMounted')",
" })",
" const refData = toRefs(data);",
" return {",
" ...refData,",
" }",
"",
" }",
" };",
"</script>",
"<style scoped>",
"</style>",
],
"description":"Log output to console"
}
}
3.新建.vue结尾的⽂件,输⼊vue3 按键盘的TAB ⾃动⽣成模板,省⼼省⼒!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论