First install the VUE plugin on IDEA
File > Plugins > Marketplace > vue
Set the VUE template location
File > Settings > Editor > File and Code Templates > Files > Vue Signle File Component
注意取消勾选 Reformat according to style (取消自动重新格式化)
<template>
#[[$END$]]#
</template>
<script>
export default {
name: "${COMPONENT_NAME}",
components: {},
props: {},
data() {
return{}
},
//计算属性 类似于data概念
computed: {},
//监控data中的数据变化
watch: {},
//方法集合
methods: {},
//生命周期 - 创建完成(可以访问当前this实例)
created() {},
//生命周期 - 挂载完成(可以访问DOM元素)
mounted() {},
//生命周期 - 创建之前
beforeCreate() {},
//生命周期 - 挂载之前
beforeMount() {},
//生命周期 - 更新之前
beforeUpdate() {},
//生命周期 - 更新之后
updated() {},
//生命周期 - 销毁之前
beforeDestroy() {},
//生命周期 - 销毁完成
destroyed() {},
//如果页面有keep-alive缓存功能,这个函数会触发
activated() {}
};
</script>
<style scoped>
</style>
Solve the problem that IDEA cannot create a new vue file
Find the vue template and click 4 to copy the vue component template
It will appear at the bottom, a copied vue component template, modify the name and the value in the template to,
(Name is Vue Component, change the original "{COMPONENT_NAME}" to name: "COMPONENT NAME" to name: "{NAME}" in the code template) as shown in the figure below