Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add category demo #35

Merged
merged 1 commit into from
Jul 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -120,7 +123,7 @@
</template>
<script>
import FormModel from 'model/Form';

import categoryList from './components/datas/data5';
export default {
data() {
return {
Expand All @@ -132,6 +135,13 @@ export default {
3: '其他'
},
param1: ['美金', '人民币', '卢布'],
categoryParam: {
title: '测试',
keyName: 'id',
titleName: 'name',
dataMode: 'tree',
datas: categoryList
},
isLoading: false,
validationRules: {
rules: {
Expand All @@ -155,6 +165,7 @@ export default {
},
required: [
'autocomplete',
'category',
'select2',
'select3',
'inputs[].value',
Expand Down
3 changes: 2 additions & 1 deletion 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 All @@ -23,4 +24,4 @@ export default new Model({
inputs: [],
things: ['']
})
;
;