Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App中 css v-bind() 不生效 #4695

Open
sangguanghui opened this issue Jan 19, 2024 · 2 comments
Open

App中 css v-bind() 不生效 #4695

sangguanghui opened this issue Jan 19, 2024 · 2 comments

Comments

@sangguanghui
Copy link

sangguanghui commented Jan 19, 2024

<script setup lang="ts">
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'
}
</script>
<style lang="scss">
.app-container {
  --app-status-bar-height: v-bind(statusBarHeight);
}
</style>

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

vue3 + ts

PixPin_2024-01-19_19-48-09

@yurj26
Copy link
Contributor

yurj26 commented Jan 30, 2024

请提供下完整的测试工程

@sand1018
Copy link

刚碰到这个问题,app.vue 的scss 使用 v-bind不生效

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants