@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.
31 lines (30 loc) • 663 B
JavaScript
import "../chunk-G2ADBYYC.js";
import { init, change, initService } from "./index";
const api = ["state", "change", "emit"];
const renderless = (props, { watch, reactive }, { service, emit }) => {
const $service = initService({ props, service });
const state = reactive({
source: null,
options: [],
selectedValue: props.modelValue
});
const api2 = {
state,
emit,
change: change(emit),
init: init({ state, service: $service })
};
watch(
() => props.modelValue,
(newValue) => {
state.selectedValue = newValue;
},
{ immediate: true }
);
api2.init();
return api2;
};
export {
api,
renderless
};