解決vue動(dòng)態(tài)下拉菜單 有數(shù)據(jù)未反應(yīng)的問題
問題出現(xiàn)在當(dāng)時(shí)后臺(tái)數(shù)據(jù)會(huì)返回到data中但是沒有出現(xiàn)下拉菜單,查詢資料 發(fā)現(xiàn) Vue的this理解有誤
jsp 下拉菜單
<select name='plantModelParentId' v-model='vueObj.plantModelParentId' @change='selectChange'> <option value=''></option> <option v-for='(item,index) in selectlist' :value='index'> {{item.plantModelName}}</option></select>
JS
new Vue({ el : '#vueadd', data : { vueObj : {}, selectlist : [] }, created : function() { // 判斷搜索是否為父級(jí)為空 var a = 0; //var self=this.selectlist出錯(cuò) 原因是并未找到selectlist 經(jīng)過查詢資料this指向的事new Vue var self=this; $.ajax({ type : 'post', url : basePath + '/cultmanage/seachCult.do', dataType : ’json’, data : { plantModelParentId : a, }, success : function(data) { //會(huì)返回后臺(tái)的值 但是沒出現(xiàn)下拉框 //console.log(JSON.stringify(data)); self.selectlist = data; }, error : function(data, type, err) { alert('錯(cuò)誤類型:' + type + '; 錯(cuò)誤信息:' + err); } }); }
補(bǔ)充知識(shí):vue+elementUI導(dǎo)航中,點(diǎn)擊body子菜單收縮的問題
項(xiàng)目中用到了vue+elementUI,發(fā)現(xiàn)點(diǎn)擊body導(dǎo)航子菜單會(huì)收縮的問題
原因:是elementUI版本的問題,發(fā)現(xiàn)我使用的是2.4.11版本,卸載重新安裝2.4.9版本就可以了
安裝命令:
cnpm uninstall element-ui//卸載
cnpm install [email protected] --save
以上這篇解決vue動(dòng)態(tài)下拉菜單 有數(shù)據(jù)未反應(yīng)的問題就是小編分享給大家的全部內(nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持好吧啦網(wǎng)。
相關(guān)文章:
1. 如何在jsp界面中插入圖片2. ASP實(shí)現(xiàn)加法驗(yàn)證碼3. python selenium 獲取接口數(shù)據(jù)的實(shí)現(xiàn)4. ASP刪除img標(biāo)簽的style屬性只保留src的正則函數(shù)5. 詳解JSP 內(nèi)置對(duì)象request常見用法6. 利用ajax+php實(shí)現(xiàn)商品價(jià)格計(jì)算7. Python matplotlib 繪制雙Y軸曲線圖的示例代碼8. jsp EL表達(dá)式詳解9. JSP servlet實(shí)現(xiàn)文件上傳下載和刪除10. springboot集成與使用Sentinel的方法
