vue2模板:

{
	"Print to console": {
		"prefix": "vue2",
		"body": [
			"<template>",
				"<div class=\"container\">", 
				
				"</div>",
			"</template>",
			"<script> ",
			"export default {",
				"name: '',",
				"data: function () {",
				"return {",
				" ",
				"}",
				"},",
				"watch: {",
				" ",
				"},",
				"components: {",
				" ",
				" },",
				"methods:{",
				" ",
				" },",
				"mounted: function () {",
				" ",
				"},",
				"beforeCreate: function () {",
				" ",
				"}",
			"}",
			"</script>",
			"<style scoped lang=\"scss\">", 
			" ",
			"</style>"
		],
		"description": "Log output to console"
	}
}

vue3模板:

{
	"Print to console": {
		"prefix": "vue3",
		"body": [
			"<template>",
				"<div class=\"container\">", 
				" ",
				"</div>",
            "</template>",
            "<script>",
			" ",
            "import { defineComponent, getCurrentInstance, onMounted, onBeforeMount, reactive, toRefs } from 'vue'", 
            "export default defineComponent({",
				"name:'',",
				"props: { },",
				"emits:[],",
				"components: {", 
				" ",
				"},",
				"setup(props, ctx){",
					"const { proxy } = getCurrentInstance();",
					"const state = reactive({",
					" ",
					"})",
					"onMounted(() => {",
					" ",
					"})",
					"onBeforeMount(() => {",
					" ",
					"})",
					" ",
					"return {",
						"...toRefs(state),",
						" ",
					"}",
				"}",
			"})",
            "</script>",
            "<style scoped lang=\"scss\">", 
			" ",
            "</style>",
			" "
			],
			"description": "A vue file template"
	}
}

vue3的setup语法糖:

{
	"Print to console": {
		"prefix": "v-setup",
		"body": [
		"<template>",
		"<div class=\"container\">", 
		" ",
		"</div>",
		"</template>",
		"<script setup>",
		"import { getCurrentInstance, onBeforeMount, onMounted, reactive } from 'vue'",
		"const { proxy } = getCurrentInstance();",
		"const emits = defineEmits([])",
		"const props = defineProps({",
		" ",
		"})",
		"const state = reactive({",
		" ",
		"})",

		"onBeforeMount(() => {",
		" ",
		"})",
		"onMounted(() => {",
		" ",
		"})",
		"defineExpose({ state })",
		" ",
		"</script> ",
		"<style lang=\"scss\" scoped>",
		" ",
		"</style>"
	],
	"description": "vue3"
	}
}

函数:

{
	"Print to console": {
		"scope": "javascript,typescript",
		"prefix": "cfun",
		"body": [
			"const func$1 = () => {",
			"$0",
			"}"
		],
		"description": "Log output to console"
	}
}
GitHub 加速计划 / vu / vue
207.54 K
33.66 K
下载
vuejs/vue: 是一个用于构建用户界面的 JavaScript 框架,具有简洁的语法和丰富的组件库,可以用于开发单页面应用程序和多页面应用程序。
最近提交(Master分支:2 个月前 )
73486cb5 * chore: fix link broken Signed-off-by: snoppy <michaleli@foxmail.com> * Update packages/template-compiler/README.md [skip ci] --------- Signed-off-by: snoppy <michaleli@foxmail.com> Co-authored-by: Eduardo San Martin Morote <posva@users.noreply.github.com> 4 个月前
e428d891 Updated Browser Compatibility reference. The previous currently returns HTTP 404. 5 个月前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐