1 Vue 组件
1.1 全局组件
<body>
<div id="app">
<model1></model1>
</div>
</body>
<script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.10/vue.js"></script>
<script>
Vue.component("model1",{
template:"<h1>Hello</h1>"
})
new Vue({
el:"#app",
})
</script>
1.2 组件的本地化注册
<body>
<div id="app">
<model1></model1>
</div>
</body>
<script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.10/vue.js"></script>
<script>
var model1 = {
template: "<h1>Hello</h1>"
}
new Vue({
el: "#app",
components:{
"model1":model1,
}
})
</script>
2 实例生命周期钩子
https://cn.vuejs.org/v2/guide/instance.html#实例生命周期钩子
转载请注明原文地址:https://tech.qufami.com/read-11094.html