vue傳數據到模態框中


寫一下我的做法

<a data-toggle="modal" data-target="#delete_tpl_modal" class="btn btn-default del" @click="ID=item.CustomerID"><i class="icon-remove"></i>刪除</a>

點擊刪除按鈕觸發模態框,同時通過@click事件將ID設置為當前的ID

var vm = new Vue({
      el: "#container",
      data:{
        ID:null
     }
     methods:{
        Delete_Customer_Data:function(){
              this.$http.post('xxx',{CustomerID:this.ID}).then(function(response){    
                    // 響應成功回調
                    if(response.data>0){
                        msg('1','刪除成功!');
                        this.Get_Customer_Data();
                    }else{
                        msg('3','刪除失敗!');
                    }
                }, function(response){    
                    // 響應錯誤回調
                    msg('3','刪除失敗!');
                });
            }
     }
   })    

刪除的時候通過this.ID取得ID進行刪除

若有寫不明白的地方,望提出來,我再修改。

 

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM