Skip to content

Commit

Permalink
feat: add category demo
Browse files Browse the repository at this point in the history
Closes #29
  • Loading branch information
jenson.liuzx authored and vvpvvp committed Jul 16, 2019
1 parent 8b486f9 commit 47de150
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 1 deletion.
57 changes: 57 additions & 0 deletions src/components/demo-components/components/datas/data5.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
export default [
{
id: 101911,
name: '游族网络股份有限公司'
},
{
id: 101894,
name: '网易(杭州)网络有限公司'
},
{
id: 101731,
name: '杭州实业'
},
{
id: 101708,
name: 'STEELE猫咪有限公司'
},
{
id: 70642,
name: '大众点评',
externalName: ''
},
{
id: 20262,
name: '产品测试验收公司(切勿修改)'
},
{
id: 50,
name: '上海希格斯网络科技有限公司上海希格斯网络科技有限公司'
},
{
id: 9,
name: '阿里巴巴14',
children: [
{
id: 29,
name: '阿里巴巴29'
},
{
id: 39,
name: '阿里巴巴39'
},
{
id: 49,
name: '阿里巴巴49'
},
{
id: 59,
name: '阿里巴巴59'
}
]
},
{
id: 7,
name: '阿里巴巴12'
}
];
13 changes: 12 additions & 1 deletion src/components/demo-components/form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@
<FormItem label="自定义规则" prop="things[0]" required>
<input type="text" v-model="data.things[0]" />
</FormItem>
<FormItem label="分类选择" prop="category">
<Category :option="categoryParam" type="key" v-model="data.category"></Category>
</FormItem>
<FormItemList>
<FormItem v-for="(item, index) of data.inputs" :key="item" :label="'输入框'+(index+1)" :prop="'inputs['+index+'].value'">
<Row type="flex">
Expand Down Expand Up @@ -121,7 +124,7 @@
</template>
<script>
import FormModel from 'model/Form';
import categoryList from './components/datas/data5';
export default {
data() {
return {
Expand All @@ -133,6 +136,13 @@ export default {
3: '其他'
},
param1: ['美金', '人民币', '卢布'],
categoryParam: {
title: '测试',
keyName: 'id',
titleName: 'name',
dataMode: 'tree',
datas: categoryList
},
isLoading: false,
validationRules: {
rules: {
Expand All @@ -152,6 +162,7 @@ export default {
},
required: [
'autocomplete',
'category',
'select2',
'select3',
'inputs[].value',
Expand Down
1 change: 1 addition & 0 deletions src/js/model/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export default new Model({
select3: [],
taginputs: [],
autocomplete: null,
category: null,
money: {
min: null,
max: null
Expand Down

0 comments on commit 47de150

Please sign in to comment.