// 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>
0 个回复