VUE笔记
开启项目
npm install
运行
npm run serve
编译
npm run build
单元测试
npm run test
Lints and fixes files
npm run lint
页面常用
<template>
<div id="app">
</div>
</template>
<script>
export default {
name: 'app',
data() {
return {
message: 'xuxiao is boy'
};
},
components: {
<!-- 组件 -->
},
beforeCreate: function() {
console.group('beforeCreate 创建前状态===============》');
// 举个栗子:可以在这加个loading事件
},
created: function() {
console.group('created 创建完毕状态===============》');
// 在这结束loading,还做一些初始化,实现函数自执行
},
beforeMount: function() {
console.group('beforeMount 挂载前状态===============》');
},
mounted: function() {
console.group('mounted 挂载结束状态===============》');
// 在这发起后端请求,拿回数据,配合路由钩子做一些事情
},
beforeUpdate: function() {
console.group('beforeUpdate 更新前状态===============》');
},
updated: function() {
console.group('updated 更新完成状态===============》');
},
beforeDestroy: function() {
console.group('beforeDestroy 销毁前状态===============》');
// 你确认删除XX吗? destroyed :当前组件已被删除,清空相关内容
},
destroyed: function() {
console.group('destroyed 销毁完成状态===============》');
}
};
</script>
<style>
</style>
网友评论