yanzhen-design-vue
Version:
41 lines (40 loc) • 1.5 kB
JavaScript
import { defineComponent, openBlock, createBlock, unref, mergeProps, isRef, createSlots, withCtx, renderSlot } from "vue";
import { Table } from "vxe-table";
import { vxeTableName, vxeTableProps, vxeTableEmits, vxeTableOptions } from "./vxe-table.mjs";
import { useVxeTable } from "./use-vxe-table.mjs";
const _sfc_main = /* @__PURE__ */ defineComponent({
...{ name: vxeTableName },
__name: "vxe-table",
props: vxeTableProps,
emits: vxeTableEmits,
setup(__props, { expose: __expose, emit: __emit }) {
const ns = vxeTableOptions.ns;
const props = __props;
const emit = __emit;
const {
ctx: { tableRef, tableExpose, dataSource, $slots, tableProps: tablePropsRef },
methods: { handleTableScroll }
} = useVxeTable(props, emit);
__expose(tableExpose);
return (_ctx, _cache) => {
return openBlock(), createBlock(unref(Table), mergeProps({
ref_key: "tableRef",
ref: tableRef,
data: unref(dataSource),
"onUpdate:data": _cache[0] || (_cache[0] = ($event) => isRef(dataSource) ? dataSource.value = $event : null),
class: unref(ns).b()
}, unref(tablePropsRef), { onScroll: unref(handleTableScroll) }), createSlots({ _: 2 }, [
unref($slots).default ? {
name: "default",
fn: withCtx(() => [
renderSlot(_ctx.$slots, "default")
]),
key: "0"
} : void 0
]), 1040, ["data", "class", "onScroll"]);
};
}
});
export {
_sfc_main as default
};