UNPKG

@opentiny/vue-renderless

Version:

An enterprise-class UI component library, support both Vue.js 2 and Vue.js 3, as well as PC and mobile.

30 lines (29 loc) 682 B
import "../chunk-G2ADBYYC.js"; import { init, change, initService } from "./index"; const api = ["state", "change", "clear", "visibleChange"]; const renderless = (props, { watch, reactive }, { emit, service }) => { const $service = initService({ props, service }); const state = reactive({ options: [], source: null, selectedValue: props.modelValue }); const api2 = { state, change: change(emit), init: init({ state, props, service: $service }) }; watch( () => props.modelValue, (propsValue) => { state.selectedValue = propsValue; }, { immediate: true } ); api2.init(); return api2; }; export { api, renderless };