UNPKG

@frontend_worker/search-selector

Version:

《远程搜索+单选》组件区别于element-ui或iview组件库的select远程搜索, ①将头部显示的值和下拉选项显示的值独立开来, ②避免远程加载时头部默认值显示异常, ③支持插槽自定义 ④将搜索框值放置于下拉弹框里面

33 lines (24 loc) 681 B
import Spin from './spin.js'; let spinInstance; function getSpinInstance (render = undefined) { spinInstance = spinInstance || Spin.newInstance({ render: render }); return spinInstance; } function loading (options) { const render = ('render' in options) ? options.render : undefined; let instance = getSpinInstance(render); instance.show(options); } Spin.show = function (props = {}) { return loading(props); }; Spin.hide = function () { if (!spinInstance) return false; const instance = getSpinInstance(); instance.remove(() => { spinInstance = null; }); }; export default Spin;