vue 在methods中調(diào)用mounted的實(shí)現(xiàn)操作
首先可以在data中先聲明一個(gè)變量
比如 sureDelBox : ’ ’
mounted 中 --->

methods 中 ---> this.sureDelBox(item) 直接this調(diào)用
這時(shí)候要傳的參數(shù)別忘記帶上
如果你要問(wèn)在mounted中調(diào)用methods中的方法
那么如果是我 我會(huì)直接把這個(gè)方法直接寫在mounted中
補(bǔ)充知識(shí):vue中methods一個(gè)方法調(diào)用另外一個(gè)方法
vue在同一個(gè)組件內(nèi);
methods中的一個(gè)方法調(diào)用methods中的另外一個(gè)方法
可以在調(diào)用的時(shí)候 this.$options.methods.test2();
this.$options.methods.test2();一個(gè)方法調(diào)用另外一個(gè)方法;
new Vue({ el: ’#app’, data: { test:111, }, methods: { test1:function(){ alert(this.test) }, test2:function(){ alert('this is test2') alert(this.test) //test3調(diào)用時(shí)彈出undefined }, test3:function(){ this.$options.methods.test2();//在test3中調(diào)用test2的方法 } }})
以上這篇vue 在methods中調(diào)用mounted的實(shí)現(xiàn)操作就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持好吧啦網(wǎng)。
相關(guān)文章:
1. 什么是python的自省2. php模擬實(shí)現(xiàn)斗地主發(fā)牌3. 詳解Android studio 動(dòng)態(tài)fragment的用法4. spring acegi security 1.0.0 發(fā)布5. MyBatis中的JdbcType映射使用詳解6. vue 使用localstorage實(shí)現(xiàn)面包屑的操作7. Vue封裝一個(gè)TodoList的案例與瀏覽器本地緩存的應(yīng)用實(shí)現(xiàn)8. Vuex localStorage的具體使用9. Python random庫(kù)使用方法及異常處理方案10. jQuery 實(shí)現(xiàn)DOM元素拖拽交換位置的實(shí)例代碼

網(wǎng)公網(wǎng)安備