// plugins/selectPopup.js
import {
    createApp
} from 'vue';
import SelectPopup from './selectPopup.vue';

export default {
    install(app) {
        const popupApp = createApp(SelectPopup);
        // #ifdef H5
        const popupInstance = popupApp.mount(document.createElement('div'));
        document.body.appendChild(popupInstance.$el);

        // 提供 open 方法
        const openPopup = (config) => {
            popupInstance.open(config);
        };
        // #endif

        // #ifndef H5
        const openPopup = (config) => {};
        // #endif
        // 提供给所有组件使用
        app.provide('openSelectPopup', openPopup);
    }
};