123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <template>
- <view class="single-drop-list" @click="show = true">
- <u--input
- v-model="name"
- disabled
- disabledColor="#ffffff"
- :placeholder="placeholder"
- border="none"
- ></u--input>
- <u-icon
- slot="right"
- name="arrow-right"
- ></u-icon>
- <u-action-sheet
- :show="show"
- :actions="src"
- :title="placeholder"
- @close="show = false"
- @select="onSelect"
- >
- </u-action-sheet>
- </view>
- </template>
- <script>
- export default {
- name: 'single-drop-list',
- props: {
- src: {
- type: Array,
- default: () => [],
- },
- defaultValue: {
- type: String,
- default: () => {},
- },
- placeholder: {
- type: String,
- default: '选择参会单位',
- }
- },
- data() {
- return {
- show: false,
- name: '',
- value: '',
- };
- },
- watch: {
- src: {
- handler(val) {
- if (val && val.length > 0 && this.defaultValue) {
- const defItem = val.find((item) => String(item.value) === this.defaultValue);
- if (defItem) {
- this.name = defItem.name;
- }
- }
- },
- immediate: true,
- },
- },
- created() {
- },
- mounted() {
- },
- methods: {
- onSelect(item) {
- this.name = item.name;
- this.$emit('onChange', item);
- },
- },
- };
- </script>
- <style lang="scss" src="./index.scss" />
|