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