vue例項的資料使用

2021-10-10 11:22:59 字數 421 閱讀 3377

一、vue例項可以使用的資料有哪些

1、例項本身有data、computed、props

2、例項原型上有$store、$router、$parent、$son、$refs等

二、可以使用這些資料的位置

1、template模板中的雙花括號中

//vuex中狀態title

}//data、computed、props等中的title

}

2、template模板中屬性繫結的雙引號中

3、script標籤中(js中)

this.title

this.$store.title

this.$router.push()

Vue例項裡this的使用

這是vue文件裡的原話 all lifecycle hooks are called with their this context pointing to the vue instance invoking it.意思是 在vue所有的生命週期鉤子方法 如created,mounted,updat...

Vue例項裡this的使用

這是vue文件裡的原話 all lifecycle hooks are called with their this context pointing to the vue instance invoking it.意思是 在vue所有的生命週期鉤子方法 如created,mounted,updat...

Vue 元件例項屬性的使用

因為最近面試了 二 三十個人,發現大部分都還是只是停留在 vue 文件的教程。有部分連教程這部分的文件也沒看全。所以稍微寫一點,讓新上手的 vuer 多了解 vue 文件的其他更需要關注的點。因為 vue 文件已經是個很成熟的文件,並且實現的 demo 簡潔明瞭,我就不具體寫實現 了,文內只會貼需要...