2***@qq.com
2***@qq.com
  • 发布:2020-05-27 16:18
  • 更新:2021-05-02 11:49
  • 阅读:11403

【已解决】Popup 弹出层 出错[Vue warn]: Unknown custom element

分类:uni-app

完成的错误提示:[Vue warn]: Unknown custom element: <uni-popup-dialog> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

有在页面上单独引入的组件,因为在另一个页面有同样的写法,是成功的,但是在这个页面就不行了。有哪位大神可以帮我看看吗?
/ 调用提示框插件 /

<uni-popup ref="popup" type="dialog">  
     <uni-popup-dialog type="input" message="成功消息" :duration="2000" :before-close="true" @close="dialogClose" @confirm="dialogConfirm">  
    </uni-popup-dialog>  
</uni-popup>


/ 引入提示框插件 /

    import uniPopup from '@/components/uni-popup/uni-popup.vue';  
    import uniPopupDialog from '@/components/uni-popup/uni-popup-dialog.vue'   
    export default {  
        mounted() {  
            uniPopup,  
            uniPopupDialog,  
            lineList  
        },  
     }

// 点击方法

type(){  
    this.$refs.popup.open()  
    // this.$refs.popupDialog.open()  
},  
/* 对话框点击确认按钮 */  
dialogConfirm(done) {  
    console.log('你点击了确认按钮');  
    // 需要执行 done 才能关闭对话框  
    done()  
},  
/**  
 * 对话框取消按钮  
 */  
dialogClose(done) {  
    // console.log('你点击了取消按钮');  
    // 需要执行 done 才能关闭对话框  
    done()  
}

2020-05-27 16:18 负责人:无 分享
已邀请:
2***@qq.com

2***@qq.com (作者)

    import uniPopup from '@/components/uni-popup/uni-popup.vue';    
    import uniPopupDialog from '@/components/uni-popup/uni-popup-dialog.vue'     
    export default {    
        mounted() {    
            uniPopup,    
            uniPopupDialog,    
            lineList    
        },    
     }

改为:

    import uniPopup from '@/components/uni-popup/uni-popup.vue';    
    import uniPopupDialog from '@/components/uni-popup/uni-popup-dialog.vue'     
    export default {    
        components: {    
            uniPopup,    
            uniPopupDialog,    
            lineList    
        },    
     }
Donsoem

Donsoem - 哈哈哈

建议这里手动修改源码导包

该问题目前已经被锁定, 无法添加新回复