1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
| import message from './message.js';
| // 定义 type 类型:弹出类型:top/bottom/center
| const config = {
| // 顶部弹出
| top: 'top',
| // 底部弹出
| bottom: 'bottom',
| // 居中弹出
| center: 'center',
| // 消息提示
| message: 'top',
| // 对话框
| dialog: 'center',
| // 分享
| share: 'bottom',
| }
|
| export default {
| data() {
| return {
| config: config,
| popupWidth: 0,
| popupHeight: 0
| }
| },
| mixins: [message],
| computed: {
| isDesktop() {
| return this.popupWidth >= 500 && this.popupHeight >= 500
| }
| },
| mounted() {
| const fixSize = () => {
| const {
| windowWidth,
| windowHeight,
| windowTop
| } = uni.getSystemInfoSync()
| this.popupWidth = windowWidth
| this.popupHeight = windowHeight + windowTop
| }
| fixSize()
| // #ifdef H5
| if (window) {
| window.addEventListener('resize', fixSize)
| this.$once('hook:beforeDestroy', () => {
| window.removeEventListener('resize', fixSize)
| })
| }
| // #endif
| },
| }
|
|