当前位置: 首页 > news >正文

vscode新建vue3文件模板

在这里插入图片描述
在这里插入图片描述
输入快捷新建的名字
在这里插入图片描述
enter 确认后在文件中输入以下内容

{// Place your snippets for vue here. Each snippet is defined under a snippet name and has a prefix, body and// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the// same ids are connected.// Example:// "Print to console": {//  "prefix": "log",//  "body": [//    "console.log('$1');",//    "$2"//  ],//  "description": "Log output to console"// }"Print to console": {"prefix": "vue3","body": ["<template>","  <div $1></div>","</template>","","<script setup>","import { ref, reactive, toRefs, onBeforeMount, onMounted, watchEffect, computed } from 'vue';","import { useStore } from 'vuex';","import { useRoute, useRouter } from 'vue-router';","/**","* 仓库","*/","const store = useStore();","/**","* 路由对象","*/","const route = useRoute();","/**","* 路由实例","*/","const router = useRouter();","//console.log('1-开始创建组件-setup')","/**","* 数据部分","*/","const data = reactive({})","onBeforeMount(() => {","  //console.log('2.组件挂载页面之前执行----onBeforeMount')","})","onMounted(() => {","  //console.log('3.-组件挂载到页面之后执行-------onMounted')","})","watchEffect(()=>{","})","// 使用toRefs解构","// let { } = { ...toRefs(data) } ","defineExpose({","  ...toRefs(data)","})","","</script>","<style scoped lang='scss'>","</style>"],"description": "Log output to console"}
}

使用
在.vue 文件输入vue3(新建时输入的名字), 按enter就可以新建好模板
在这里插入图片描述

http://www.lryc.cn/news/154870.html

相关文章:

  • MySql学习笔记02——MySql的简单介绍
  • mysql-1:认识mysql
  • 算法通关村-----堆在查找和排序中的应用
  • 直方图统计增强方法
  • 字节二面:如果高性能渲染十万条数据?
  • Mysql高阶语句(二)
  • 算法笔记 二叉搜索树
  • 微软牵手Linux:Ubuntu“系统”上架win10应用商店啦
  • leetcode做题笔记126. 单词接龙 II
  • windows下运行springboot的jar包,修改替换class文件,修改配置文件application,打包
  • PMD 检查java代码:可以去掉无用的括号(UselessParentheses)
  • 【数据结构练习】栈的面试题集锦
  • 简单工厂模式概述和使用
  • 软件工程概述
  • 国际网页短信软件平台搭建定制接口说明|移讯云短信系统
  • Java“牵手”阿里巴巴店铺所有商品API接口数据,通过店铺ID获取整店商品详情数据,阿里巴巴店铺所有商品API申请指南
  • 【Sql】把数据库字段用函数根据逗号分裂成列表,然后判断列表中是否包含目标值
  • docker基本命令记录
  • web之利用延迟实现复杂动画、animation
  • TCP 和 UDP 的区别、TCP 是如何保证可靠传输的?
  • 鼠标悬停阴影的效果被旁边div挡住的解决办法
  • Go用两个协程交替打印100以内的奇偶数
  • css 文字单行多行超出长度后显示 ...
  • C++将派生类赋值给基类
  • 海外问卷调查是做什么的?
  • Redis——数据结构介绍
  • 附录2-将三国演义按章节存储为不同的txt(bs4)
  • 现代C++中的从头开始深度学习:【6/8】成本函数
  • Vue——vue3中的ref和reactive数据理解以及父子组件之间props传递的数据
  • 新手如何备考PMP考试?