<template>
<transition name="fade">
<div class="mask" v-if="show" @click="show=!show">
<img :src="imgUrl" alt="">
</div>
</transition>
</template>
<script>
export default {
data() {
return {
show: false,
imgUrl: ""
};
},
components: {}
};
</script>
<style lang='scss' scoped>
@import "src/style/mixin";
.fade-enter,
.fade-leave-active {
opacity: 0;
}
.fade-enter-active,
.fade-leave-active {
transition: opacity 0.35s;
}
.mask {
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
background-color: rgba($color: #000000, $alpha: .3);
img {
width: 100%;
}
}
</style>
import Vue from 'vue'
import Popup from './share.vue'
const PopupBox = Vue.extend(Popup)
Popup.install = function () {
let data = {
imgUrl: require("@/assets/image/message/share.png"),
};
let instance = new PopupBox({
data
}).$mount();
document.body.appendChild(instance.$el)
Vue.nextTick(() => {
instance.show = true
})
}
export default Popup
import share from "@/components/share/share";
Vue.prototype.$share = share.install;