Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/v2'
Browse files Browse the repository at this point in the history
  • Loading branch information
richard1015 committed Jan 9, 2020
2 parents 411fd30 + bdc43e4 commit 6a24bbd
Show file tree
Hide file tree
Showing 47 changed files with 1,818 additions and 145 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
## 2.1.9

`2020-01-09`

* :sparkles: feat(CheckboxGroup):增加全选、反选功能 @richard1015
* :sparkles: feat(uploader):上传组件支持withCredentials参数 #190 @richard1015
* :sparkles: feat:新增popup组件 @yangkaixuan
* :sparkles: feat:新增Elevator电梯楼层组件 @zhenyulei
* :sparkles: feat:新增textbox文本域组件 @guoxiao158
* :bug: fix(calendar):修复日历组件 当某个月的1号是周日时,月份下方会空出来一行 @irisSong
* :bug: fix(menu):修复组件多实例bug #182 @Ymm0008
* :bug: fix(col):修复组件中文字超出时样式问题 @richard1015
* :bug: fix(imagepicker):imgList双向绑定问题 #187 @richard1015
* :bug: fix(toast):修复toast多实例关闭事件冲突 #181 @guoxiao158
* :zap: doc:修改(picker自定义数据demo;cdn按需加载;VueCLI3按需加载); @richard1015

## 2.1.8

`2019-12-11`
Expand Down
82 changes: 79 additions & 3 deletions docs/start.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,41 @@ CDN 引入示例
</html>
```

CDN 按需加载引入示例

```html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>

<body>
<div id="app">
<nut-button>cdn按需加载</nut-button>
</div>

<!-- 开发环境版本,包含了有帮助的命令行警告 -->
<!-- 引入样式 -->
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@nutui/nutui@latest/dist/packages/button/button.css"
/>
<!-- 引入Vue -->
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<!-- 引入组件库 -->
<script src="https://cdn.jsdelivr.net/npm/@nutui/nutui@latest/dist/packages/button/button.js"></script>
<script>
Vue.component(button.default.name, button.default);
new Vue({
el: "#app"
});
</script>
</body>
</html>
```

> 在页面中直接引入,将无法使用 **主题定制** 等功能。我们推荐使用 *NPM**YARN* 方式安装,不推荐在页面中直接引入的用法
* 通过 **Vue CLI** 图形化界面安装
Expand Down Expand Up @@ -118,7 +153,7 @@ npm i @nutui/babel-plugin-separate-import -D

然后配置一下babel的配置文件

```bash
``` bash
{
"plugins": [
["@nutui/babel-plugin-separate-import", {
Expand All @@ -140,7 +175,7 @@ Picker.install(Vue);
```
如果需要按需加载 scss 文件(如需要自定义主题)时,除了需要把 style 选项值设为为 **scss** 外,还需要修改 webpack 配置文件的 sass-loader 配置,如下所示:

```
``` bash
{
loader: 'sass-loader',
options: {
Expand All @@ -149,6 +184,28 @@ Picker.install(Vue);
}
```

`vue.config.js` VueCLI3 配置方式

``` bash
module.exports = {
css: {
loaderOptions: {
// 给 sass-loader 传递选项
scss: {
// @/ 是 src/ 的别名
// 注意:在 sass-loader v7 中,这个选项名是 "data"
prependData: `
@import "@/assets/custom_theme.scss";
@import "@nutui/nutui/dist/styles/index.scss";
`,
}
},
}
}
```

> VueCLI 3 相关Demo 请查看 [NutUI Demo](https://github.com/richard1015/nutui-demo)
### 2. 手动引入

```javascript
Expand All @@ -168,7 +225,26 @@ Button.install(Vue);
<nut-switch :active="true" size="base"></nut-switch>
```

2.组件 css 单位使用的是 **px**,如果你的项目中需要 **rem** 单位,可借助一些工具进行转换,比如 webpack 的 [px2rem-loader](https://www.npmjs.com/package/px2rem-loader)、postcss 的 [postcss-plugin-px2rem](https://www.npmjs.com/package/postcss-plugin-px2rem) 插件等
2.组件 css 单位使用的是 **px**,如果你的项目中需要 **rem** 单位,可借助一些工具进行转换,比如 [webpack](https://www.webpackjs.com/)[px2rem-loader](https://www.npmjs.com/package/px2rem-loader)[postcss](https://github.com/postcss/postcss)[postcss-plugin-px2rem](https://www.npmjs.com/package/postcss-plugin-px2rem) 插件等

VueCLI3 配置示例 `vue.config.js`
``` javascript
const pxtorem = require('postcss-pxtorem');
module.exports = {
css: {
loaderOptions: {
postcss: {
plugins: [
pxtorem({
rootValue: 37.5,
propList: ['*']
})
]
}
}
}
}
```

3.组件具体用法以文档为准

Expand Down
24 changes: 23 additions & 1 deletion docs/theme.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,26 @@ $dark-color: #DADADA;
}
```

如果你的项目使用的是VueCLI 3以上版本 请修改 `vue.config.js` 进行配置

``` bash
module.exports = {
css: {
loaderOptions: {
// 给 sass-loader 传递选项
scss: {
// @/ 是 src/ 的别名
// 注意:在 sass-loader v7 中,这个选项名是 "data"
prependData: `
@import "@/assets/custom_theme.scss";
@import "@nutui/nutui/dist/styles/index.scss";
`,
}
},
}
}
```

### 第三步:引用组件样式时引用 SCSS 文件

在主题定制场景下,项目中引用组件时,需要引入 **SCSS** 文件,而不是 **CSS** 文件。分三种情况:
Expand Down Expand Up @@ -79,4 +99,6 @@ import '@nutui/nutui/dist/packages/button/button.scss';
}]
]
}
```
```

> VueCLI 3 相关Demo 请查看 [NutUI Demo](https://github.com/richard1015/nutui-demo)
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nutui/nutui",
"version": "2.1.8",
"version": "2.1.9",
"description": "一套轻量级移动端Vue组件库",
"typings": "dist/types/index.d.ts",
"main": "dist/nutui.js",
Expand Down Expand Up @@ -162,4 +162,4 @@
"instrument": false,
"sourceMap": false
}
}
}
2 changes: 1 addition & 1 deletion sites/doc/compents/hidden/hidden.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export default {
}
.hide{
position: relative;
max-height: 2000px;
max-height: 4000px;
}
.bar{
height: 30px;
Expand Down
32 changes: 31 additions & 1 deletion src/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,36 @@
"sort": "0",
"showDemo": true,
"author": "zhuzhida"
},
{
"version": "1.0.0",
"name": "TextBox",
"chnName": "文本域",
"desc": "文本域",
"type": "component",
"sort": "1",
"showDemo": true,
"author": "guoxiaoxiao"
},
{
"version": "1.0.0",
"name": "Elevator",
"chnName": "电梯楼层",
"desc": "类似于电梯楼层,组件可以跟着右侧索引而滑动",
"type": "component",
"sort": "3",
"showDemo": true,
"author": "zhenyulei"
},
{
"version": "1.0.0",
"name": "Popup",
"chnName": "弹出层",
"desc": "弹出层",
"type": "component",
"sort": "5",
"showDemo": true,
"author": "杨凯旋"
}
]
}
}
Loading

0 comments on commit 6a24bbd

Please sign in to comment.