色婷婷狠狠18禁久久YY,CHINESE性内射高清国产,国产女人18毛片水真多1,国产AV在线观看

vue 8個

錢淋西2年前8瀏覽0評論

Vue 8大核心特性,是Vue.js框架中最重要的8個特性之一。

1. 響應式系統

let data = {msg: 'Hello Vue!'}
let vm = new Vue({
data: data
})
vm.msg = 'Hello World!'
//現在只需修改vm.msg,不必擔心重新渲染Vue實例。

2. 模板語法

let vm = new Vue({
data: {
message: 'Hello Vue!'
}
})

{{message}}

3. 計算屬性

let vm = new Vue({
data: {
firstName: 'John',
lastName: 'Doe'
},
computed: {
fullName: function() {
return this.firstName + ' ' + this.lastName
}
}
})

{{fullName}}

4. 組件

Vue.component('todo-item', {
props: ['todo'],
template: '<li>{{ todo.text }}</li>'
})

<todo-item v-for="item in list" :todo="item"></todo-item>

5. 插槽(slot)

<button v-on:click="$emit('close')">Click me to close <slot>

6. 生命周期

let vm = new Vue({
data: {
message: 'Hello Vue!'
},
beforeCreate: function () {
console.log('beforeCreate')
},
created: function () {
console.log('created')
},
beforeMount: function () {
console.log('beforeMount')
},
mounted: function () {
console.log('mounted')
},
beforeUpdate: function () {
console.log('beforeUpdate')
},
updated: function () {
console.log('updated')
},
beforeDestroy: function () {
console.log('beforeDestroy')
},
destroyed: function () {
console.log('destroyed')
}
})

7. Mixin

let mixin = {
created: function () {
this.hello()
},
methods: {
hello: function () {
console.log('hello from mixin!')
}
}
}
let vm = new Vue({
mixins: [mixin],
created: function () {
console.log('created')
}
})

8. 插件(Plugin)

Vue.use(pluginName)

其中,pluginName是你要安裝的插件名稱。