废话不多说,直接上步骤吧
npm install vue-layer
import layer from 'vue-layer'
import 'vue-layer/lib/vue-layer.css'
Vue.prototype.layer = layer(Vue)
let testIndex = this.layer.open({
type: 2,
title: 'layer 测试',
area: 'auto',
btn: '确定',
shade: 0.4,
content: {
content: Test, // Test为要打开的子组件Name
parent: this
}
})
setTimeout(() => {
this.layer.close(testIndex) // 关闭此弹框
}, 2000)