zoukankan      html  css  js  c++  java
  • vue 结合mint-ui Message box的使用方法

    两种方式使用:

    一、全局注册

    1.在main.js中引入

    //引入

    import { MessageBox } from 'mint-ui';

     
    //全局使用,挂载到原型上

    Vue.prototype.$messagebox = MessageBox   

    2.在xxx.vue使用

    //alert

    this.$messagebox.alert("操作成功").then(action => {
     
    });
     
    //confirm
     
    this.$messagebox.confirm("确定执行此操作?").then(action => {
     
    });
     
    //prompt
     
    this.$messagebox.prompt("请输入你的姓名").then(({ value, action }) => {
     
    });
     
    二、局部使用
     
    1.在xxx.vue文件的script标签中引入
     
    import { MessageBox } from 'mint-ui';
     
    2.使用
     
    //alert
     
    MessageBox.alert("确定执行此操作?").then(action => {
     
    });
     
    //confirm
     
    MessageBox.confirm("确定执行此操作?").then(action => {
     
    });
     
    //prompt
     
    MessageBox.prompt("确定执行此操作?").then(({ value, action }) => {
     
    });
     

     附加:(toast | indicator | messagebox)三者使用方式一样

    Vue.$messagebox = Vue.prototype.$messagebox = MessageBox;

    Vue.$toast = Vue.prototype.$toast = Toast;

    Vue.$indicator = Vue.prototype.$indicator = Indicator;


     

  • 相关阅读:
    将查询语句创建新表
    java冒泡排序
    java三元运算符
    java中的>>>和>>>=
    i++和++i
    设计4个线程,其中两个线程每次对j增加1,另外两个线程对j每次减少1。
    System.out.println与System.err.println的区别
    try-catch-finally
    Java常见异常类
    Vue.js环境配置
  • 原文地址:https://www.cnblogs.com/zousaili/p/9284890.html
Copyright © 2011-2022 走看看