jd-opensource / jd-opensource/taro-ui

自定义主题颜色不生效

Open
#854 6 comments 0 reactions 0 assignees View on GitHub
stale
Dominant language
TypeScript
Stars
4.7k
Forks
740
PR merge metrics
No merged PRs in 30d

Description

**问题描述**
我使用官网的主题生成器生成了一个绿色主题,把scss样式和文件按照文档引用进去,首页和里面页面的按钮颜色都是蓝色不生效,另外一个“我的”页面却是可以的。
研究两天了,也看过issue了,项目和微信开发者工具都重启过了,也不行,用的版本都是挺新的。

![image](https://user-images.githubusercontent.com/16473160/68672209-17bc5400-058c-11ea-97c2-0fa26960eba0.png)

**复现步骤**

app.js
```tsx
...
import './custom-variables.scss';
import './app.scss';
...
```

custom-variables.scss
```scss
/* Custom Theme */
$color-brand: #00b38a;
$color-brand-light: #40c6a7;
$color-brand-dark: #008f6e;

@import "~taro-ui/dist/style/index.scss";

```

app.scss
```scss
/* reset */
image {
max-width: 100%;
}

/* page */
page {
background-color: #f6f6f6;
padding: .512rem 0;
}

.container {
padding: 0 1rem;
}

```

**期望行为**
蓝色按钮都变为绿色。

**报错信息**
![image](https://user-images.githubusercontent.com/16473160/68672846-6fa78a80-058d-11ea-87f2-438a4ee13f44.png)
![image](https://user-images.githubusercontent.com/16473160/68672863-7930f280-058d-11ea-8253-c3b62a2e0b3d.png)
“首页”还有“编辑“和”查看“页面进去的按钮都是蓝色的,就“我的”页面按钮是绿色的。

**系统信息**
👽 Taro v1.3.22

Taro CLI 1.3.22 environment info:
System:
OS: macOS 10.15.1
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 9.6.0 - ~/.nvm/versions/node/v9.6.0/bin/node
npm: 5.6.0 - ~/.nvm/versions/node/v9.6.0/bin/npm
npmPackages:
@tarojs/async-await: ^1.3.20 => 1.3.20
@tarojs/components: 1.3.20 => 1.3.20
@tarojs/plugin-babel: 1.3.20 => 1.3.20
@tarojs/plugin-csso: 1.3.20 => 1.3.20
@tarojs/plugin-sass: 1.3.20 => 1.3.20
@tarojs/plugin-uglifyjs: 1.3.20 => 1.3.20
@tarojs/redux: ^1.3.20 => 1.3.20
@tarojs/redux-h5: ^1.3.20 => 1.3.20
@tarojs/router: 1.3.20 => 1.3.20
@tarojs/taro: 1.3.20 => 1.3.20
@tarojs/taro-alipay: 1.3.20 => 1.3.20
@tarojs/taro-h5: 1.3.20 => 1.3.20
@tarojs/taro-qq: 1.3.20 => 1.3.20
@tarojs/taro-quickapp: 1.3.20 => 1.3.20
@tarojs/taro-swan: 1.3.20 => 1.3.20
@tarojs/taro-tt: 1.3.20 => 1.3.20
@tarojs/taro-weapp: 1.3.20 => 1.3.20
@tarojs/webpack-runner: 1.3.20 => 1.3.20
eslint-config-taro: 1.3.20 => 1.3.20
eslint-plugin-taro: 1.3.20 => 1.3.20
nerv-devtools: ^1.5.0 => 1.5.0
nervjs: ^1.5.1 => 1.5.1
stylelint-config-taro-rn: 1.3.20 => 1.3.20
stylelint-taro-rn: 1.3.20 => 1.3.20

- Taro 版本:1.3.20
- Taro UI 版本:2.2.3
- 报错平台:微信小程序

**补充信息**
暂无。

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.