dcloudio / dcloudio/uni-app

App中 css v-bind() 不生效

Open
#4,695 3 comments 0 reactions 1 assignee Claimed by @GRCmade View on GitHub
app uni api 不明确复现步骤、未提供复现工程
Dominant language
JavaScript
Stars
41.6k
Forks
3.7k
Avg merge
7h 6m
Merged PRs (30d)
6

Description

```

import { onLaunch, onShow, onHide } from '@dcloudio/uni-app'
import { useSystemStore } from '@/stores/system'
const systemStore = useSystemStore()
const statusBarHeight = ref('')

onLaunch(() => {
console.log('App Launch')
// 初始化配置信息
setting()
})
onShow(() => {
console.log('App Show')
})
onHide(() => {
console.log('App Hide')
})

/**
* 初始化配置信息
*/
const setting = () => {
// 获取机型适配信息
Object.assign(systemStore.$state, uni.getSystemInfoSync())
statusBarHeight.value = systemStore.statusBarHeight + 'px'
statusBarHeight.value = '28px'
}

.app-container {
--app-status-bar-height: v-bind(statusBarHeight);
}

```

> v-bind() h5端生效但 app端不生效

> vue3 + ts

![PixPin_2024-01-19_19-48-09](https://github.com/dcloudio/uni-app/assets/111712231/f693c56f-c48a-4793-ad76-e0e8386b5574)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.