WebApp【公共组件库】@前端(For Git Submodule)
Tevin
2021-07-08 fff7c8cad5d7c6dfd1dc7f134362995fc260f410
forms/select/CSelect.vue
@@ -37,7 +37,7 @@
                :disabled="itemRes.disabled"
                :error="itemRes.error"
                :placeholder="placeholder"
                :value="chose.name"
                :value="choose.name"
            >
                <view class="at-icon at-icon-chevron-right" />
            </AtInput>
@@ -48,6 +48,7 @@
<script>
import Taro from '@tarojs/taro';
import { AtInput } from 'taro-ui-vue';
import { $pagePoster } from '@components/common/PagePoster';
import './cSelect.scss';
export default {
@@ -69,7 +70,10 @@
    },
    data() {
        return {
            chose: {},
            choose: {
                name: '',
                value: null,
            },
        };
    },
    computed: {
@@ -107,25 +111,19 @@
            } else {
                url += '?mode=CSelect';
            }
            if (this.chose && typeof this.chose.value !== 'undefined') {
                url += '&value=' + JSON.stringify(this.chose.value);
            }
            Taro.navigateTo({
                url,
                events: {
                    'CSelect:onSelected': data => {
                        const value = data.id || data.value || data.key;
                        this.chose = {
                            name: data.name,
                            value,
                        };
                        this.itemRes.onChange(value);
                        this.onSelectFromPage && this.onSelectFromPage(data);
                    },
                },
            const eventor = $pagePoster.createEventor();
            eventor.on('@linked', () => {
                eventor.emit('lastValue', this.choose.value);
            });
            eventor.on('selected', data => {
                this.choose.name = data.name;
                this.choose.value = data.value;
                this.itemRes.onChange(data.value);
                this.onSelectFromPage && this.onSelectFromPage(data.value);
                eventor.destroy();
            });
            Taro.navigateTo({ url: url + '&eventorId=' + eventor.id });
        },
    },
    mounted() {},
};
</script>