蓝调华尔兹
蓝调华尔兹
  • 发布:2023-02-01 09:02
  • 更新:2023-02-01 09:02
  • 阅读:262

uniapp 中使用 tsx ,引入css module,在安卓不生效,在H5上生效

分类:uni-app

uniapp 中使用 tsx ,引入css module,在安卓不生效,在H5上生效,
示例代码:

index.module.scss  
.content {  
    display: flex;  
    flex-direction: column;  
    align-items: center;  
    justify-content: center;  

    .logo {  
        height: 200rpx;  
        width: 200rpx;  
        margin-top: 200rpx;  
        margin-left: auto;  
        margin-right: auto;  
        margin-bottom: 50rpx;  
    }  

    .text-area {  
        display: flex;  
        justify-content: center;  
    }  

    .title {  
        font-size: 36rpx;  
        color: #8f8f94;  
    }  

}  

index.tsx  
import { defineComponent, ref } from 'vue'  
import styles from './index.module.scss'  
export default defineComponent({  
    name: 'index',  
    setup() {  
        console.log(styles)  
        const title = ref('Hello')  
        return {title}  
    },  
    render(){  
        return (<view class={styles.content}>  
            <image style={styles.logo} src="/static/logo.png"></image>  
            <view class={styles['text-area']}>  
                <text class={styles.title}>{this.title}</text>  
            </view>  
        </view>)  
    }  
})

在H5上有样式

在Android上没有样式

2023-02-01 09:02 负责人:无 分享
已邀请:

要回复问题请先登录注册