12 Star 73 Fork 28

DCloud/hello-uniapp

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
popup.js 974 Bytes
一键复制 编辑 原始数据 按行查看 历史
tianjiaxing 提交于 2021-01-13 20:34 +08:00 . uni-ui component support for pc
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
window.addEventListener('resize', fixSize)
this.$once('hook:beforeDestroy', () => {
window.removeEventListener('resize', fixSize)
})
// #endif
},
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/dcloud/hello-uniapp.git
[email protected]:dcloud/hello-uniapp.git
dcloud
hello-uniapp
hello-uniapp
master

搜索帮助