本文共 985 字,大约阅读时间需要 3 分钟。
// 在 main.js 中全局注册组件import Confirm from './components/confirm'Vue.component('Confirm', Confirm)
// 在子组件中使用,因为已经全局注册了,所以不用再局部注册,直接使用即可export default { mounted () { let configObj = { titleText: '感谢您的推荐!', confirmText: '推荐其他酒店', cancelText: '协议酒店意见反馈', type: 'confirm', mainClass: 'recommend', data: 'goResult' } this.$refs.myConfirm.show(configObj) }, methods: { userBehaviorFun (type, data) { if (type === 'clickConfirm' && data === 'goResult') { } else if (type === 'clickCancel' && data === 'goResult') { } else if (type === 'clickClose' && data === 'goResult') { } } }}
转载地址:http://mnpo.baihongyu.com/