WebApp【公共组件库】@前端(For Git Submodule)
Tevin
2025-01-16 e4bc100e00845f62b6c83dd28fc216ff78c62031
forms/select/CSelect.vue
@@ -67,7 +67,6 @@
<script>
import Taro from '@tarojs/taro';
import { AtInput } from 'taro-ui-vue';
import { $pagePoster } from '@components/common/PagePoster';
import './cSelect.scss';
export default {
@@ -87,11 +86,8 @@
            type: Boolean,
            default: false,
        },
        // 开启选择菜单跳转选择页面模式,并指定功能页面,url or 'on'
        //   url 模式已经废弃,即将删除代码,请勿再使用
        // 开启选择菜单跳转选择页面模式,值为 'on'
        selectByPage: String,
        // 页面跳转URL模式下,选择完成后的回调
        onSelectFromPage: Function,
        // 页面跳转on模式下,发起选择的回调
        onOpenSelectorPage: Function,
    },
@@ -140,30 +136,15 @@
                this.onOpenSelectorPage && this.onOpenSelectorPage();
                return;
            }
            // 页面跳转URL模式,已废弃,即将删除代码
            console.warn('CSelect:警告,url跳转已废弃,即将删除代码,请勿使用!');
            let url = this.selectByPage;
            if (this.selectByPage.indexOf('?') > 0) {
                url += '&mode=CSelect';
            } else {
                url += '?mode=CSelect';
            }
            if (this._eventor) {
                // 销毁上次事件收发器
                this._eventor.destroy();
            }
            this._eventor = $pagePoster.createEventor();
            this._eventor.on('@linked', () => {
                this._eventor.emit('lastValue', this.choose.value);
            });
            this._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);
            });
            Taro.navigateTo({ url: url + '&eventorId=' + this._eventor.id });
            // 页面跳转URL模式已废弃
            console.warn('CSelect:警告,url跳转已废弃,无法再使用!');
        },
    },
    mounted() {
        if (this.selectByPage && this.selectByPage !== 'on') {
            // 页面跳转URL模式已废弃
            console.warn('CSelect:警告,url跳转已废弃,无法再使用!');
        }
    },
};
</script>