cc-element-components
Version:
该项目是基于`element-plus`二次封装组件,使用的技术栈为`vue3` + `typescript` + `element-plus`。在此项目当中,我们会基于`element-plus`的组件库已有组件封装如下组件: - 图标选择器 - 时间选择器 - 城市选择器 - 省市区选择器 - 通知菜单 - 趋势标记 - 评论 - 数据列表 - 数值统计 - 倒计时 - 分割面板 - 时间轴 - 弹框拓展 - 进度条拓展 - 导航菜单拓展 - 可配置项表格 - 可配置项表单 - 日历
99 lines (98 loc) • 3.04 kB
JavaScript
import { defineComponent, ref, watch, resolveComponent, openBlock, createElementBlock, normalizeClass, createVNode, mergeProps, unref, isRef, withCtx, renderSlot } from "vue";
const _sfc_main = /* @__PURE__ */ defineComponent({
props: {
isScroll: {
type: Boolean,
default: false
},
visible: {
type: Boolean,
default: false
},
options: {
type: Array,
required: true
},
onChange: {
type: Function
},
beforeUpload: {
type: Function
},
onPreview: {
type: Function
},
onRemove: {
type: Function
},
beforeRemove: {
type: Function
},
onSuccess: {
type: Function
},
onExceed: {
type: Function
}
},
emits: ["update:visible"],
setup(__props, { emit: emits }) {
const props = __props;
let form = ref();
let dialogVisible = ref(props.visible);
watch(() => props.visible, (val) => {
dialogVisible.value = val;
});
watch(() => dialogVisible.value, (val) => {
emits("update:visible", val);
});
return (_ctx, _cache) => {
const _component_m_form = resolveComponent("m-form");
const _component_el_dialog = resolveComponent("el-dialog");
return openBlock(), createElementBlock("div", {
class: normalizeClass({ "m-choose-icon-dialog-body-height": __props.isScroll })
}, [
createVNode(_component_el_dialog, mergeProps({
modelValue: unref(dialogVisible),
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(dialogVisible) ? dialogVisible.value = $event : dialogVisible = $event)
}, _ctx.$attrs), {
default: withCtx(() => [
createVNode(_component_m_form, {
ref: (_value, _refs) => {
_refs["form"] = _value;
isRef(form) ? form.value = _value : form = _value;
},
options: __props.options,
"label-width": "100px",
onOnChange: __props.onChange,
onBeforeUpload: __props.beforeUpload,
onOnPreview: __props.onPreview,
onOnRemove: __props.onRemove,
onBeforeRemove: __props.beforeRemove,
onOnSuccess: __props.onSuccess,
onOnExceed: __props.onExceed
}, {
uploadArea: withCtx(() => [
renderSlot(_ctx.$slots, "uploadArea")
]),
uploadTip: withCtx(() => [
renderSlot(_ctx.$slots, "uploadTip")
]),
_: 3
}, 8, ["options", "onOnChange", "onBeforeUpload", "onOnPreview", "onOnRemove", "onBeforeRemove", "onOnSuccess", "onOnExceed"])
]),
footer: withCtx(() => [
renderSlot(_ctx.$slots, "footer", { form: unref(form) })
]),
_: 3
}, 16, ["modelValue"])
], 2);
};
}
});
var index = {
install(app) {
app.component("cc-modal-form", _sfc_main);
}
};
export { index as default };