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

Element MessageBox彈框的具體使用

 更新時(shí)間:2020年07月27日 10:13:44   作者:ForeverJPB.  
這篇文章主要介紹了Element MessageBox彈框的具體使用,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧

組件—彈框

消息提示


<template>
 <el-button type="text" @click="open">點(diǎn)擊打開 Message Box</el-button>
</template>

<script>
 export default {
  methods: {
   open() {
    this.$alert('這是一段內(nèi)容', '標(biāo)題名稱', {
     confirmButtonText: '確定',
     callback: action => {
      this.$message({
       type: 'info',
       message: `action: ${ action }`
      });
     }
    });
   }
  }
 }
</script>

確認(rèn)消息


<template>
 <el-button type="text" @click="open">點(diǎn)擊打開 Message Box</el-button>
</template>

<script>
 export default {
  methods: {
   open() {
    this.$alert('這是一段內(nèi)容', '標(biāo)題名稱', {
     confirmButtonText: '確定',
     callback: action => {
      this.$message({
       type: 'info',
       message: `action: ${ action }`
      });
     }
    });
   }
  }
 }
</script>

提交內(nèi)容


<template>
 <el-button type="text" @click="open">點(diǎn)擊打開 Message Box</el-button>
</template>

<script>
 export default {
  methods: {
   open() {
    this.$prompt('請輸入郵箱', '提示', {
     confirmButtonText: '確定',
     cancelButtonText: '取消',
     inputPattern: /[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/,
     inputErrorMessage: '郵箱格式不正確'
    }).then(({ value }) => {
     this.$message({
      type: 'success',
      message: '你的郵箱是: ' + value
     });
    }).catch(() => {
     this.$message({
      type: 'info',
      message: '取消輸入'
     });    
    });
   }
  }
 }
</script>

自定義


<template>
 <el-button type="text" @click="open">點(diǎn)擊打開 Message Box</el-button>
</template>

<script>
 export default {
  methods: {
   open() {
    const h = this.$createElement;
    this.$msgbox({
     title: '消息',
     message: h('p', null, [
      h('span', null, '內(nèi)容可以是 '),
      h('i', { style: 'color: teal' }, 'VNode')
     ]),
     showCancelButton: true,
     confirmButtonText: '確定',
     cancelButtonText: '取消',
     beforeClose: (action, instance, done) => {
      if (action === 'confirm') {
       instance.confirmButtonLoading = true;
       instance.confirmButtonText = '執(zhí)行中...';
       setTimeout(() => {
        done();
        setTimeout(() => {
         instance.confirmButtonLoading = false;
        }, 300);
       }, 3000);
      } else {
       done();
      }
     }
    }).then(action => {
     this.$message({
      type: 'info',
      message: 'action: ' + action
     });
    });
   }
  }
 }
</script>

使用 HTML 片段


<template>
 <el-button type="text" @click="open">點(diǎn)擊打開 Message Box</el-button>
</template>

<script>
 export default {
  methods: {
   open() {
    this.$alert('<strong>這是 <i>HTML</i> 片段</strong>', 'HTML 片段', {
     dangerouslyUseHTMLString: true
    });
   }
  }
 }
</script>

區(qū)分取消與關(guān)閉


<template>
 <el-button type="text" @click="open">點(diǎn)擊打開 Message Box</el-button>
</template>

<script>
 export default {
  methods: {
   open() {
    this.$alert('<strong>這是 <i>HTML</i> 片段</strong>', 'HTML 片段', {
     dangerouslyUseHTMLString: true
    });
   }
  }
 }
</script>

居中布局


<template>
 <el-button type="text" @click="open">點(diǎn)擊打開 Message Box</el-button>
</template>

<script>
 export default {
  methods: {
   open() {
    this.$confirm('此操作將永久刪除該文件, 是否繼續(xù)?', '提示', {
     confirmButtonText: '確定',
     cancelButtonText: '取消',
     type: 'warning',
     center: true
    }).then(() => {
     this.$message({
      type: 'success',
      message: '刪除成功!'
     });
    }).catch(() => {
     this.$message({
      type: 'info',
      message: '已取消刪除'
     });
    });
   }
  }
 }
</script>

全局方法

單獨(dú)引用

Options




到此這篇關(guān)于Element MessageBox彈框的具體使用的文章就介紹到這了,更多相關(guān)Element MessageBox彈框內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • 如何構(gòu)建 vue-ssr 項(xiàng)目的方法步驟

    如何構(gòu)建 vue-ssr 項(xiàng)目的方法步驟

    這篇文章主要介紹了如何構(gòu)建 vue-ssr 項(xiàng)目的方法步驟,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-08-08
  • vue2 elementui if導(dǎo)致的rules判斷失效的解決方法

    vue2 elementui if導(dǎo)致的rules判斷失效的解決方法

    文章討論了在使用Vue2和ElementUI時(shí),將if語句放在el-form-item內(nèi)導(dǎo)致rules判斷失效的問題,并提出了將判斷邏輯移到外部的解決方案,感興趣的朋友一起看看吧
    2024-12-12
  • Vue?watch監(jiān)聽使用的幾種方法

    Vue?watch監(jiān)聽使用的幾種方法

    watch是由用戶定義的數(shù)據(jù)監(jiān)聽,當(dāng)監(jiān)聽的屬性發(fā)生改變就會(huì)觸發(fā)回調(diào),這項(xiàng)配置在業(yè)務(wù)中是很常用。在面試時(shí),也是必問知識(shí)點(diǎn),一般會(huì)用作和computed進(jìn)行比較。那么本文就來帶大家從源碼理解watch的工作流程,以及依賴收集和深度監(jiān)聽的實(shí)現(xiàn)
    2022-12-12
  • vuex中store存儲(chǔ)store.commit和store.dispatch的用法

    vuex中store存儲(chǔ)store.commit和store.dispatch的用法

    這篇文章主要介紹了vuex中store存儲(chǔ)store.commit和store.dispatch的用法,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2020-07-07
  • 很棒的vue彈窗組件

    很棒的vue彈窗組件

    這篇文章主要為大家詳細(xì)介紹了vue彈窗組件的相關(guān)資料,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2017-05-05
  • Vue表單及表單綁定方法

    Vue表單及表單綁定方法

    今天小編就為大家分享一篇Vue表單及表單綁定方法,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2018-09-09
  • vue中watch和computed的區(qū)別與使用方法

    vue中watch和computed的區(qū)別與使用方法

    這篇文章主要給大家介紹了關(guān)于vue中watch和computed的區(qū)別與使用方法的相關(guān)資料,文中通過實(shí)例代碼結(jié)束的非常詳細(xì),對大家學(xué)習(xí)或者使用Vue具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-08-08
  • 在vue.config.js中優(yōu)化webpack配置的方法

    在vue.config.js中優(yōu)化webpack配置的方法

    在日常開發(fā)中我們離不開打包工具webpack,但是不同的配置會(huì)影響我們項(xiàng)目的運(yùn)行構(gòu)建時(shí)間,也會(huì)影響打包之后項(xiàng)目包的大小,這篇文章記錄一下我使用過的可以優(yōu)化webpack的配置,需要的朋友可以參考下
    2024-05-05
  • Vue?quill-editor?編輯器使用及自定義toobar示例詳解

    Vue?quill-editor?編輯器使用及自定義toobar示例詳解

    這篇文章主要介紹了Vue quill-editor編輯器使用及自定義toobar示例詳解,這里講解編輯器quil-editor的知識(shí)結(jié)合實(shí)例代碼給大家介紹的非常詳細(xì),需要的朋友可以參考下
    2023-07-07
  • 解決el-cascader在IE11瀏覽器中加載頁面自動(dòng)展開下拉框問題

    解決el-cascader在IE11瀏覽器中加載頁面自動(dòng)展開下拉框問題

    這篇文章主要為大家介紹了解決el-cascader在IE11瀏覽器中加載頁面自動(dòng)展開下拉框問題,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-06-06

最新評論

连平县| 宁阳县| 横峰县| 杭锦后旗| 安宁市| 安吉县| 永安市| 桐乡市| 仲巴县| 饶平县| 周口市| 安远县| 阿尔山市| 合川市| 洪湖市| 三明市| 吕梁市| 邛崃市| 亳州市| 城固县| 乐陵市| 冀州市| 常德市| 宁武县| 饶平县| 蓝田县| 东明县| 安塞县| 太保市| 中牟县| 蓬莱市| 商南县| 甘谷县| 固镇县| 武胜县| 连南| 通城县| 扶风县| 泾阳县| 申扎县| 宝坻区|