全局组件与全局插件的区别
全局组件的使用方式:
<VNavbar></VNavbar>
全局插件的使用方式:
methods: {
showMsgbox (){
this.$msgbox({
type: 'warning',
title: '温馨提示',
cancel: '取消',
content: '这里可以放置HTML',
confirm: '确定',
className: 'pop-custom'
}).then(() => {
console.log("我点击了确定按钮")
}).catch((err) => {
console.log("error")
})
}
}
1. 在src/components 目录新建 msgbox 目录
在 msgbox 目录,新建 msgbox.vue 组件。
msgbox.vue:
<template>
<div>
<transition name="msgbox">
</transition>
<div class="msgbox-mask" v-show="isShowMask"></div>
</div>
</template>