Skip to content

Commit 85cc49d

Browse files
committed
chore: 导入特殊的 Select 和 Option 组件
1 parent 4e57652 commit 85cc49d

File tree

3 files changed

+43
-4
lines changed

3 files changed

+43
-4
lines changed

README.md

+32-4
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,38 @@ $ yarn test
4343
- vue 语法高亮, less 语法高亮,es6 语法支持
4444
- eslint (最好开启保存时自动修复 auto-fix on save)
4545

46+
## 缓存策略
47+
48+
### Vuex 数据管理
49+
50+
## UI 组件
51+
52+
组件方面使用 `iView` 作为原型组件库,使用时请添加前缀 `I`
53+
54+
``` html
55+
<IButton type="primary">确定</IButton>
56+
57+
<IForm>
58+
<IFormItem>
59+
<IInput v-model="name" placeholder="默认有前缀 I" />
60+
61+
<Select>
62+
<Option>这两个组件没有前缀 `I`</Option>
63+
</Select>
64+
</IFormItem>
65+
</IForm>
66+
```
67+
68+
> **注意**: `Select` `Option` 这两个组件**不能**添加前缀 `I`,否则会不能选中选择项
69+
70+
### 按需加载
71+
72+
iView 使用按需加载,如果要使用某组件,在 `plugins/iview` 中加载即可
73+
74+
> 若导入后缺失样式,在 `assets/less/iview/components/index.less` 中将相应组件的注释打开即可
75+
76+
iView 样式表使用 less 重新导入在 `assets/less/iview/`
77+
4678
## API
4779

4880
### 全局组件
@@ -94,10 +126,6 @@ export default {
94126

95127
## iView
96128

97-
iView 使用按需加载,如果要使用某组件,在 `plugins/iview` 中加载即可
98-
99-
iView 样式表使用 less 重新导入在 `assets/less/iview/`
100-
101129
[组件手册](https://www.iviewui.com/docs/guide/start)
102130

103131
## axios

assets/less/iview.less

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
&-body {
1111
padding: 0;
1212
}
13+
&-rel {
14+
width: 100%;
15+
}
1316
}
1417

1518
.ivu-modal {

plugins/iview.js

+8
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
Button,
66
Breadcrumb,
77
BreadcrumbItem,
8+
Checkbox,
89
Form,
910
FormItem,
1011
Input,
@@ -18,12 +19,15 @@ import {
1819
Spin,
1920
Tag,
2021
AutoComplete,
22+
Select,
23+
Option,
2124
} from 'iview'
2225

2326
const components = {
2427
Button,
2528
Breadcrumb,
2629
BreadcrumbItem,
30+
Checkbox,
2731
Form,
2832
FormItem,
2933
Input,
@@ -44,6 +48,10 @@ const install = function (Vue, opts = {}) {
4448
Vue.component(`I${key}`, components[key])
4549
})
4650

51+
// 这两个需要特殊处理,不使用前缀`I`, 因为如果加了前缀使用会异常
52+
Vue.component('Select', Select)
53+
Vue.component('Option', Option)
54+
4755
Vue.prototype.$Message = Message
4856
Vue.prototype.$Modal = Modal
4957
Vue.prototype.$Notice = Notice

0 commit comments

Comments
 (0)