uniapp 全局弹窗
功能详解
1.有的组件需要全局调用,不想要在一个页面里面一个个引入,现在就需要写入到全局中,直接全局触发。
2.通过 $rechargePop就能全局触发 充值的弹窗
实现步骤
一、先把组件封装好,如 rechargePop组件
位置 components/RechargePop/index.vue ,就定义一个methods open方法就可以
<template><uni-popup ref="rechargePop" type="bottom" :is-mask-click="true" mask-background-color="rgba(0,0,0,0.6)"></uni-popup>
</template><script>export default {components: {},data() {return {navIndex: 0}},methods: {open() {this.$refs.rechargePop.open();},close(