欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

vue.js做一個(gè)簡(jiǎn)單的編輯菜譜功能

 更新時(shí)間:2018年05月08日 10:32:26   作者:小達(dá)哥的垃圾桶  
本文通過實(shí)例代碼給大家一個(gè)簡(jiǎn)單的基于vue.js實(shí)現(xiàn)的編輯菜譜功能,代碼簡(jiǎn)答易懂,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友參考下吧

先給大家展示下效果圖,如果感覺不錯(cuò),請(qǐng)參考實(shí)現(xiàn)代碼

1、先獲取門店下的所有菜品類型、菜品名稱、菜品id(list),也就是最大數(shù)據(jù)量

this.$http.post(ceshiApi+'getCyFoodAndFoodTypeForShopId',{shopId:this.shopId},{emulateJSON:true,credentials: true}).then(function(res){
  if(res.data.type=='success'){
    this.foodList = res.data.data.cyFoodTypeList;
  }
});

2、獲取該菜譜已經(jīng)擁有(勾選了哪些)的菜品id(list)

this.$http.post(ceshiApi+'getCyMenuFoodByMenuId',{'cyMenuId': id},{emulateJSON:true,credentials: true}).then(function(res){
  if(res.data.type=='success'){
    let data = res.data.data;
    let list = [];
    for(let i = 0; i < data.length; i++) {
      list.push(data[i].foodDefineId);
    }
    this.foodListId = list;
  }else {
    alertErrors(res.data.message);
  }
});

3、在html頁面使用vue對(duì)兩數(shù)據(jù)進(jìn)行對(duì)比,菜品id相同就打勾

<div class="modal-body">
  <div class="scroll_name ">
    <div class="newRecipe" style="overflow-y: scroll;height: 410px;">
      <div v-for="item in foodList" style="display: flex;flex-wrap: wrap;">
        <label style="margin-right: 20px;">{{ item.name }}</label>
        <div class="food-list">
          <div v-for="food in item.cyFoodDefineList">
            <label>
              <input class="ace check_son" type="checkbox" :value="food.id" v-model="foodListId">
              <span class="lbl">{{ food.name }}</span>
            </label>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>

總結(jié)

以上所述是小編給大家介紹的vue.js做一個(gè)簡(jiǎn)單的編輯菜譜功能,希望對(duì)大家有所幫助,如果大家有任何疑問請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!

相關(guān)文章

最新評(píng)論