微信登录调试
This commit is contained in:
@@ -20,7 +20,16 @@ export function useColumnCount(onChange = () => {}) {
|
||||
// }
|
||||
// }
|
||||
const calcColumn = () => {
|
||||
const width = uni.getSystemInfoSync().windowWidth
|
||||
// 使用新的API替代已废弃的getSystemInfoSync
|
||||
let width
|
||||
// #ifdef MP-WEIXIN
|
||||
const mpSystemInfo = uni.getWindowInfo()
|
||||
width = mpSystemInfo.windowWidth
|
||||
// #endif
|
||||
// #ifndef MP-WEIXIN
|
||||
const otherSystemInfo = uni.getSystemInfoSync()
|
||||
width = otherSystemInfo.windowWidth
|
||||
// #endif
|
||||
|
||||
let count = 2
|
||||
if (width >= 1000) {
|
||||
@@ -46,15 +55,20 @@ export function useColumnCount(onChange = () => {}) {
|
||||
onMounted(() => {
|
||||
columnCount.value = 2
|
||||
calcColumn()
|
||||
// if (process.client) {
|
||||
window.addEventListener('resize', calcColumn)
|
||||
// }
|
||||
// 只在H5环境下添加resize监听器
|
||||
// #ifdef H5
|
||||
if (typeof window !== 'undefined') {
|
||||
window.addEventListener('resize', calcColumn)
|
||||
}
|
||||
// #endif
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
// if (process.client) {
|
||||
window.removeEventListener('resize', calcColumn)
|
||||
// }
|
||||
// #ifdef H5
|
||||
if (typeof window !== 'undefined') {
|
||||
window.removeEventListener('resize', calcColumn)
|
||||
}
|
||||
// #endif
|
||||
})
|
||||
|
||||
// 列数变化时执行回调
|
||||
|
Reference in New Issue
Block a user