tiny-vue/examples/sites/demos/pc/app/select/map-field.vue

69 lines
1.8 KiB
Vue
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div>
<p>场景1配置式配置映射字段</p>
<br />
<tiny-select v-model="value1" multiple :options="options" value-field="val" text-field="text"> </tiny-select>
<br /><br />
<p>场景2嵌套表格配置映射字段</p>
<br />
<tiny-select
v-model="value2"
multiple
value-field="id"
text-field="city"
render-type="grid"
:grid-op="gridOp"
></tiny-select>
</div>
</template>
<script>
import { Select } from '@opentiny/vue'
export default {
components: {
TinySelect: Select
},
data() {
return {
value1: ['选项1', '选项2'],
value2: ['001', '002'],
gridOp: {
data: [
{ id: '001', area: '华南区', province: '广东省', city: '广州市' },
{ id: '002', area: '华南区', province: '广东省', city: '深圳市' },
{ id: '003', area: '华南区', province: '广东省', city: '珠海市' },
{ id: '004', area: '华南区', province: '广东省', city: '佛山市' },
{ id: '005', area: '华南区', province: '广东省', city: '中山市' }
],
columns: [
{ type: 'selection', title: '' },
{ field: 'area', title: '区域', width: 90 },
{ field: 'province', title: '省份', width: 60 },
{ field: 'city', title: '城市', width: 60 }
]
},
options: [
{ val: '选项1', text: '北京' },
{ val: '选项2', text: '上海' },
{ val: '选项3', text: '天津' },
{ val: '选项4', text: '重庆' },
{ val: '选项5', text: '深圳' },
{ val: '选项6', text: '南京' },
{ val: '选项7', text: '成都' }
]
}
}
}
</script>
<style lang="less" scoped>
.tiny-select {
width: 280px;
}
p {
font-size: 14px;
line-height: 1.5;
}
</style>