@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.
21 lines (20 loc) • 626 B
JavaScript
import "../chunk-G2ADBYYC.js";
import { xss } from "@opentiny/utils";
import { handleClick } from "./index";
const api = ["state", "handleClick"];
const renderless = (props, { inject, reactive, computed }, { emit, parent }) => {
parent.tinyForm = parent.tinyForm || inject("form", null);
const state = reactive({
formDisabled: computed(() => (parent.tinyForm || {}).disabled),
disabled: computed(() => props.disabled || state.formDisabled),
href: computed(() => xss.filterUrl(props.href))
});
return {
state,
handleClick: handleClick({ emit, props, state })
};
};
export {
api,
renderless
};