feat: 首次提交
This commit is contained in:
276
pages/component/form/picker/picker.js
Normal file
276
pages/component/form/picker/picker.js
Normal file
@ -0,0 +1,276 @@
|
||||
// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:18 614 07 2 54 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
|
||||
const options = ['7:00-8:30', '8:30-10:00', '10:00-11:30', '2:00-3:30', '3:30-5:00'];
|
||||
const options2 = [
|
||||
['2021-11-01', '2021-11-02', '2021-11-03', '2021-11-04', '2021-11-05'],
|
||||
['上午', '下午']
|
||||
];
|
||||
const options3 = [
|
||||
['A校区', 'B校区', 'C校区', 'D校区', 'E校区'],
|
||||
['50班', '60班', '70班', '80班', '90班'],
|
||||
['A组', 'B组', 'C组', 'D组', 'E组']
|
||||
];
|
||||
|
||||
const options4 = [
|
||||
['2020', '2021', '2022', '2023', '2024'],
|
||||
['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'],
|
||||
['05', '10', '15', '20', '25'],
|
||||
['9:00', '10:00', '11:00', '2:00', '3:00', '4:00'],
|
||||
];
|
||||
|
||||
const options5 = [{
|
||||
text: '北京市',
|
||||
value: '100000',
|
||||
children: [{
|
||||
text: '北京市',
|
||||
value: '110000'
|
||||
}]
|
||||
}, {
|
||||
text: '广东省',
|
||||
value: '440000',
|
||||
children: [{
|
||||
text: '广州市',
|
||||
value: '440100'
|
||||
}, {
|
||||
text: '韶关市',
|
||||
value: '440200'
|
||||
}, {
|
||||
text: '深圳市',
|
||||
value: '440300'
|
||||
}, {
|
||||
text: '珠海市',
|
||||
value: '440400'
|
||||
}, {
|
||||
text: '汕头市',
|
||||
value: '440500'
|
||||
}]
|
||||
}]
|
||||
|
||||
const options6 = [{
|
||||
text: '北京市',
|
||||
value: '100000',
|
||||
children: [{
|
||||
text: '北京市',
|
||||
value: '100100',
|
||||
children: [{
|
||||
text: '东城区',
|
||||
value: '100101'
|
||||
}, {
|
||||
text: '西城区',
|
||||
value: '100102'
|
||||
}, {
|
||||
text: '朝阳区',
|
||||
value: '100103'
|
||||
}, {
|
||||
text: '丰台区',
|
||||
value: '100104'
|
||||
}, {
|
||||
text: '石景山区',
|
||||
value: '100105'
|
||||
}]
|
||||
}]
|
||||
}, {
|
||||
text: '广东省',
|
||||
value: '440000',
|
||||
children: [{
|
||||
text: '广州市',
|
||||
value: '440100',
|
||||
children: [{
|
||||
text: '荔湾区',
|
||||
value: '440101',
|
||||
}, {
|
||||
text: '越秀区',
|
||||
value: '440102',
|
||||
}, {
|
||||
text: '海珠区',
|
||||
value: '440103',
|
||||
}, {
|
||||
text: '天河区',
|
||||
value: '440104',
|
||||
}, {
|
||||
text: '白云区',
|
||||
value: '440105',
|
||||
}]
|
||||
}, {
|
||||
text: '韶关市',
|
||||
value: '440200',
|
||||
children: [{
|
||||
text: '武江区',
|
||||
value: '440201'
|
||||
}, {
|
||||
text: '浈江区',
|
||||
value: '440202'
|
||||
}, {
|
||||
text: '曲江区',
|
||||
value: '440203'
|
||||
}, {
|
||||
text: '始兴县',
|
||||
value: '440204'
|
||||
}, {
|
||||
text: '仁化县',
|
||||
value: '440205'
|
||||
}]
|
||||
}]
|
||||
}]
|
||||
|
||||
const options7 = [{
|
||||
text: '北京市',
|
||||
value: '100000',
|
||||
children: [{
|
||||
text: '北京市',
|
||||
value: '100100',
|
||||
children: [{
|
||||
text: '东城区',
|
||||
value: '100101',
|
||||
children: [{
|
||||
text: '东花市街道',
|
||||
value: '10010101'
|
||||
}, {
|
||||
text: '龙潭街道',
|
||||
value: '10010102'
|
||||
}, {
|
||||
text: '体育馆路街道',
|
||||
value: '10010103'
|
||||
}, {
|
||||
text: '天坛街道',
|
||||
value: '10010104'
|
||||
}]
|
||||
}, {
|
||||
text: '西城区',
|
||||
value: '100102',
|
||||
children: [{
|
||||
text: '陶然亭街道',
|
||||
value: '10010201'
|
||||
}, {
|
||||
text: '广安门内街道',
|
||||
value: '10010202'
|
||||
}, {
|
||||
text: '牛街街道',
|
||||
value: '10010203'
|
||||
}, {
|
||||
text: '白纸坊街道',
|
||||
value: '10010204'
|
||||
}]
|
||||
}, {
|
||||
text: '朝阳区',
|
||||
value: '100103',
|
||||
children: [{
|
||||
text: '黑庄户地区',
|
||||
value: '10010301'
|
||||
}, {
|
||||
text: '豆各庄地区',
|
||||
value: '10010302'
|
||||
}, {
|
||||
text: '王四营地区',
|
||||
value: '10010303'
|
||||
}, {
|
||||
text: '东湖街道',
|
||||
value: '10010304'
|
||||
}, {
|
||||
text: '首都机场街道',
|
||||
value: '10010305'
|
||||
}]
|
||||
}]
|
||||
}]
|
||||
}, {
|
||||
text: '广东省',
|
||||
value: '440000',
|
||||
children: [{
|
||||
text: '广州市',
|
||||
value: '440100',
|
||||
children: [{
|
||||
text: '荔湾区',
|
||||
value: '440101',
|
||||
children: [{
|
||||
text: '茶滘街道',
|
||||
value: '44010101'
|
||||
}, {
|
||||
text: '东漖街道',
|
||||
value: '44010102'
|
||||
}, {
|
||||
text: '海龙街道',
|
||||
value: '44010103'
|
||||
}, {
|
||||
text: '东沙街道',
|
||||
value: '44010104'
|
||||
}, {
|
||||
text: '中南街道',
|
||||
value: '44010105'
|
||||
}]
|
||||
|
||||
}, {
|
||||
text: '越秀区',
|
||||
value: '440102',
|
||||
children: [{
|
||||
text: '珠光街道',
|
||||
value: '44010201'
|
||||
}, {
|
||||
text: '大东街道',
|
||||
value: '44010202'
|
||||
}, {
|
||||
text: '白云街道',
|
||||
value: '44010203'
|
||||
}, {
|
||||
text: '登峰街道',
|
||||
value: '44010204'
|
||||
}, {
|
||||
text: '矿泉街道',
|
||||
value: '44010205'
|
||||
}]
|
||||
}]
|
||||
}, {
|
||||
text: '韶关市',
|
||||
value: '440200',
|
||||
children: [{
|
||||
text: '武江区',
|
||||
value: '440201',
|
||||
children: [{
|
||||
text: '西联镇',
|
||||
value: '44020101'
|
||||
}, {
|
||||
text: '西河镇',
|
||||
value: '44020102'
|
||||
}, {
|
||||
text: '龙归镇',
|
||||
value: '44020103'
|
||||
}, {
|
||||
text: '江湾镇',
|
||||
value: '44020104'
|
||||
}, {
|
||||
text: '重阳镇',
|
||||
value: '44020105'
|
||||
}]
|
||||
}, {
|
||||
text: '浈江区',
|
||||
value: '440202',
|
||||
children: [{
|
||||
text: '十里亭镇',
|
||||
value: '44020201'
|
||||
}, {
|
||||
text: '犁市镇',
|
||||
value: '44020202'
|
||||
}, {
|
||||
text: '花坪镇',
|
||||
value: '44020203'
|
||||
}, {
|
||||
text: '田螺冲办事处',
|
||||
value: '44020204'
|
||||
}, {
|
||||
text: '曲仁办事处',
|
||||
value: '44020205'
|
||||
}]
|
||||
}]
|
||||
}]
|
||||
}]
|
||||
|
||||
|
||||
|
||||
|
||||
export default {
|
||||
options,
|
||||
options2,
|
||||
options3,
|
||||
options4,
|
||||
options5,
|
||||
options6,
|
||||
options7
|
||||
}
|
157
pages/component/form/picker/picker.vue
Normal file
157
pages/component/form/picker/picker.vue
Normal file
@ -0,0 +1,157 @@
|
||||
<!--本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 18614 0725 4 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。-->
|
||||
<template>
|
||||
<view class="fui-wrap">
|
||||
<view class="fui-page__hd">
|
||||
<view class="fui-page__title fui-align__center" @tap="vip">Picker <image
|
||||
src="/static/images/index/light/icon_member_3x.png"></image>
|
||||
</view>
|
||||
<view class="fui-page__desc">Picker 选择器,用于数据的选择,可联动选择。</view>
|
||||
</view>
|
||||
<view class="fui-page__bd">
|
||||
<fui-button type="gray" btn-size="medium" text="一级选择" bold :margin="['24rpx']"
|
||||
@click="btnClick(1)">
|
||||
</fui-button>
|
||||
<fui-button type="gray" btn-size="medium" text="二级选择 - 不联动" bold @click="btnClick(2)">
|
||||
</fui-button>
|
||||
<fui-button type="gray" btn-size="medium" text="三级选择 - 不联动" bold :margin="['24rpx']"
|
||||
@click="btnClick(3)">
|
||||
</fui-button>
|
||||
<fui-button type="gray" btn-size="medium" text="四级选择 - 不联动" bold @click="btnClick(4)">
|
||||
</fui-button>
|
||||
<fui-button type="gray" btn-size="medium" text="二级选择 - 联动" bold :margin="['24rpx']"
|
||||
@click="btnClick(5)">
|
||||
</fui-button>
|
||||
<fui-button type="gray" btn-size="medium" text="三级选择 - 联动" bold @click="btnClick(6)">
|
||||
</fui-button>
|
||||
<fui-button type="gray" btn-size="medium" text="四级选择 - 联动" bold :margin="['24rpx']"
|
||||
@click="btnClick(7)">
|
||||
</fui-button>
|
||||
<fui-button type="gray" btn-size="medium" text="设置默认值 / 暗黑" bold @click="pickerShow">
|
||||
</fui-button>
|
||||
|
||||
<view class="fui-picker__result">
|
||||
选择的值为:{{result}}
|
||||
</view>
|
||||
</view>
|
||||
<fui-picker :layer="layer" :options="items" :linkage="linkage" :show="show" @change="change" @cancel="cancel">
|
||||
</fui-picker>
|
||||
|
||||
<fui-picker theme="dark" title="请选择时间" :value="value" param="dark" :options="options" @change="onChange"
|
||||
ref="picker">
|
||||
</fui-picker>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import pkData from './picker.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
value: ['10:00-11:30'],
|
||||
result: '',
|
||||
layer: 1,
|
||||
items: [],
|
||||
linkage: false,
|
||||
show: false,
|
||||
options: pkData.options,
|
||||
options2: pkData.options2,
|
||||
options3: pkData.options3,
|
||||
options4: pkData.options4,
|
||||
options5: pkData.options5,
|
||||
options6: pkData.options6,
|
||||
options7: pkData.options7
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
vip() {
|
||||
this.fui.href("/pages/my/qa/qa?index=2&title=VIP专属内容")
|
||||
},
|
||||
btnClick(type) {
|
||||
this.show = false;
|
||||
switch (type) {
|
||||
case 1:
|
||||
this.layer = 1;
|
||||
this.linkage = false;
|
||||
this.items = this.options
|
||||
break;
|
||||
case 2:
|
||||
this.layer = 2;
|
||||
this.linkage = false;
|
||||
this.items = this.options2
|
||||
break;
|
||||
case 3:
|
||||
this.layer = 3;
|
||||
this.linkage = false;
|
||||
this.items = this.options3
|
||||
break;
|
||||
case 4:
|
||||
this.layer = 4;
|
||||
this.linkage = false;
|
||||
this.items = this.options4
|
||||
break;
|
||||
case 5:
|
||||
this.layer = 2;
|
||||
this.linkage = true;
|
||||
this.items = this.options5
|
||||
break;
|
||||
case 6:
|
||||
this.layer = 3;
|
||||
this.linkage = true;
|
||||
this.items = this.options6
|
||||
break;
|
||||
case 7:
|
||||
this.layer = 4;
|
||||
this.linkage = true;
|
||||
this.items = this.options7
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
this.$nextTick(() => {
|
||||
setTimeout(() => {
|
||||
this.show = true;
|
||||
}, 50)
|
||||
})
|
||||
},
|
||||
change(e) {
|
||||
this.show = false
|
||||
this.onChange(e)
|
||||
},
|
||||
onChange(e) {
|
||||
console.log(e)
|
||||
this.result = JSON.stringify(e || {})
|
||||
},
|
||||
cancel() {
|
||||
this.show = false
|
||||
},
|
||||
pickerShow() {
|
||||
//显示选择器
|
||||
this.$refs.picker.open()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.fui-wrap {
|
||||
padding-bottom: 64rpx;
|
||||
}
|
||||
|
||||
.fui-page__bd {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.fui-picker__result {
|
||||
width: 100%;
|
||||
padding: 64rpx 32rpx;
|
||||
box-sizing: border-box;
|
||||
font-size: 26rpx;
|
||||
word-break: break-all;
|
||||
font-weight: normal;
|
||||
}
|
||||
</style>
|
Reference in New Issue
Block a user