最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

element中的$confirm的使用

 更新時間:2020年04月26日 10:35:08   作者:yang  
這篇文章主要介紹了element中的$confirm的使用,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧

可以諸如此類的封裝一下

/*
 * 公用提示窗
 * @export
 * @param {string}[desc="確認操作"]彈框提示文字
 * @param {string}[title="提示"]彈框標題
 * @param{string}[confirmButtonName ='確認']確認按鈕文字
 * @param {string}[cancelButtonName="取消"] 取消按鈕文字
 * @param{boolean}[distinguishCancelAndClose = false]關系和取消是否執(zhí)行同一方法
 *@return
 *
 */
export function confirm (desc = '確認操作', title = '提示', confirmButtonName = '確認', cancelButtonName = '取消', distinguishCancelAndClose = false) {
 return this.$confirm(desc, title, {
  confirmButtonName: confirmButtonName,
  cancelButtonName: cancelButtonName,
  distinguishCancelAndClose: distinguishCancelAndClose,
  closeOnClickModel: false,
  type: 'warning',
  center: true
 })
}
xxx//vue
submitSome(){
  try(){
    async utils.confirm.call(this,"確認要刪除嗎")
    const formData = {
      'id':this.id
    }
    let res = await this.$post('/sss',formData)
    if(res.code===1){
     //do something
    }
  }catch(e){
   console.log(e)
   // 如果需要關閉和取消有所區(qū)別
   if(e==='close'){
    //do something
   }else if(e==='cancel'){
    //do something
   }
  }
}

this.$confirm確定框內容換行顯示

// 把寫的提示信心需要換行的地方分成數組 confirmText 
const confirmText = ['是否將此項移除?', '注意:移除后不可恢復。'] 
const newDatas = [] 
const h = this.$createElement 
for (const i in confirmText) { 
   newDatas.push(h('p', null, confirmText[i])) 
} 
 this.$confirm( 
   '提示', 
   { 
     title: '提示', 
     message: h('div', null, newDatas), 
     showCancelButton: true, 
     confirmButtonText: '確定', 
     cancelButtonText: '取消', 
     type: 'warning' 
   } ).then(() => { })

到此這篇關于element中的$confirm的使用的文章就介紹到這了,更多相關element $confirm 內容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!

相關文章

最新評論

丹东市| 磐石市| 错那县| 大化| 自治县| 郯城县| 玉树县| 滨州市| 共和县| 大竹县| 手游| 新密市| 德安县| 云浮市| 吉隆县| 大关县| 阜康市| 措勤县| 德令哈市| 浠水县| 新巴尔虎左旗| 麻江县| 罗山县| 商城县| 屯门区| 保靖县| 屯门区| 九龙坡区| 水富县| 都安| 罗定市| 曲麻莱县| 永济市| 岳西县| 荆门市| 太和县| 苍梧县| 香港| 凌海市| 彩票| 颍上县|