課程
/前端開(kāi)發(fā)
/Vue.js
/3小時(shí)速成 Vue2.x 核心技術(shù)
請(qǐng)問(wèn)這是什么原因呀?
2019-07-18
源自:3小時(shí)速成 Vue2.x 核心技術(shù) 2-4
正在回答
這個(gè)由于this作用域的問(wèn)題,你的代碼中的this.arr的this代表著是當(dāng)前的Vue實(shí)例,所以是undefined,你換成arr,去掉this. 試試?
這是代碼 <body> <div?id="app"> ????<div> ????????{{msg}} ????????<p>{{msg1}}</p> ????</div> </div> <script> ????var?arr?=?'new?test' ???var?app=?new?Vue({ ????????el:'#app', ????????data:{ ????????????msg:'hello?vue!!', ????????????another:'GoodBey?vue!!' ????????}, ????????watch:{ ????????????msg:function(newval,oldval){ ????????????????console.log('newval?is:'+newval) ????????????????console.log('oldval?is:'+oldval) ????????????}, ????????}, ????????computed:{ ????????????msg1:function(){ ????????????????return?'computed:'?+?this.msg?+'?,?'+?this.another?+?this.arr ????????????} ????????}, ???????methods:{ ???????} ????}) </script> </body>
舉報(bào)
帶你快速學(xué)習(xí)最流行的前端框架vue2.x的核心技術(shù)
1 回答數(shù)據(jù)檢索失敗
3 回答list頁(yè)面拿不到store.js的數(shù)據(jù)
1 回答list 頁(yè)面 的時(shí)候沒(méi)拿到數(shù)據(jù),數(shù)據(jù)為空
1 回答視頻結(jié)尾部分那塊添加到Vuex中 數(shù)據(jù)并沒(méi)有看到輸出的效果。 細(xì)雨清簾 視頻結(jié)尾部分那塊添加到Vuex中 數(shù)據(jù)并沒(méi)有看到輸出的效果。 我在/add 頁(yè)面上添加完的數(shù)據(jù),跳轉(zhuǎn)到 /home/list 頁(yè)面時(shí),Vuex里保存的數(shù)據(jù)就沒(méi)有。
3 回答麻煩老師看一下為什么引入外部vue.js不好用
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號(hào)-11 京公網(wǎng)安備11010802030151號(hào)
購(gòu)課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號(hào)
2019-07-18
這個(gè)由于this作用域的問(wèn)題,你的代碼中的this.arr的this代表著是當(dāng)前的Vue實(shí)例,所以是undefined,你換成arr,去掉this. 試試?
2019-07-18