创建一个vue实例:
const vm = new Vue(options)
vm:vue的一个实例
vm的构造函数是Vue,按照ES6的说法,vm所属的类是Vue
options是 new Vue 的参数,我们一般称之为选项或者构造选项
options的五大属性:
数据属性:
data-内部数据:
支持对象和函数,优先使用函数
methods-方法:
事件处理函数或者是普通函数
computed:
watch:
props-外部数据(属性):
propsData:
DOM属性:
el-挂载点:
只在用new创建实例时生效
可以用$mount() 代替
template:
render:
renderError:
生命周期钩子:
生beforeCreate、
created、
beforeMount、
mounted、
beforeUpdate、
updated、a
ctivated、
deactivated、
beforeDestroy、
destroyed、
errorCaptured
资源属性:
directives、
filters、
components-组件:
组合属性:
parent,
mixins、
extends、
provide、
inject
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。