@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.
35 lines (34 loc) • 869 B
JavaScript
import "../chunk-G2ADBYYC.js";
import { handleKeydown, mounted } from "./index";
const api = ["state", "handleKeydown"];
const renderless = (props, { computed, onMounted, reactive, watch, provide }, { parent, dispatch }) => {
const state = reactive({
radioGroupSize: computed(() => props.size),
tag: "div",
activeStyle: props.fill
});
parent.$on("handleChange", (value) => {
parent.$emit("change", value);
});
const api2 = {
state,
dispatch,
onMounted: mounted(parent),
handleKeydown: handleKeydown(parent)
};
watch(
() => props.modelValue,
(value) => {
api2.dispatch("FormItem", "form.change", [value]);
}
);
onMounted(api2.onMounted);
provide("radioVertical", props.vertical);
provide("showTips", props.showTips);
provide("size", props.size);
return api2;
};
export {
api,
renderless
};