陌上华年
陌上华年
  • 发布:2021-07-05 10:37
  • 更新:2021-07-05 10:37
  • 阅读:292

【报Bug】stylus 全局注入在nvue中失效

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: win10

HBuilderX类型: Alpha

HBuilderX版本号: 3.1.21

手机系统: Android

手机系统版本号: Android 11

手机厂商: 小米

手机机型: 小米

页面类型: nvue

打包方式: 云端

项目创建方式: HBuilderX

操作步骤:

// vue.config.js

const path = require('path')  
module.exports = {  
    chainWebpack: config => {},  
    css: {  
        loaderOptions: {  
            stylus: {  
                import: [require('path').resolve(__dirname, "./uni.styl")],  
            },  
        }  
    }  
}

1、使用stylus 全局注入样式无效
//根目录 uni.styl

$text-font-size = 32px

// 页面 index.nvue

<template>  
     <text class="text1">仪表盘</text>  
</template>  
<style lang="stylus">  
.text1  
    font-size $text-font-size  
</style>

2、独立的stylus样式表 函数 无法使用条件编译
// page/index
// index.styl

  theme()  
    // #ifndef APP-NVUE  
    color #007AFF  
     // #endif

// 页面 index.nvue


<template>  
     <text class="text1">仪表盘</text>  
</template>  
<style lang="stylus">  
@import './index'  
.text1  
    font-size $text-font-size  
        theme()  
</style>  

预期结果:

1、页面里的字体为外面注入的样式表里的值
2、独立的stylus样式表可以使用条件编译

实际结果:

不起作用

bug描述:

1、使用stylus 全局注入样式无效
2、独立的stylus样式表 函数 无法使用条件编译

2021-07-05 10:37 负责人:无 分享
已邀请:

该问题目前已经被锁定, 无法添加新回复