Advertisement

vue的toast和dialog(cube-ui实现)弹窗组件总结

阅读量:
在这里插入图片描述

index.js

复制代码
    import vue from 'vue'
    
    // 静态组件
    import toastComponent from './toast.vue'
    
    // 返回一个扩展实力构造器
    const ToastConstructor = vue.extend(toastComponent)
    
    // 定义弹出组件的函数 两个参数 显示文本和显示时间
    function showToast(text, showtime = 3000) {
    const toastDom = new ToastConstructor({
        el: document.createElement('div'),
        data() {
            return {
                text: text,
                showWrap: true, // 是否显示组件
                showContent: tru

全部评论 (0)

还没有任何评论哟~