UNPKG

plus-pro-components

Version:

Page level components developed based on Element Plus.

101 lines (96 loc) 3.68 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var vue = require('vue'); var elementPlus = require('element-plus'); var index = require('../../utils/index.js'); var is = require('../../utils/is.js'); var _sfc_main = /* @__PURE__ */ vue.defineComponent({ ...{ name: "PlusBreadcrumb" }, __name: "index", props: { routes: { default: () => [] }, replace: { type: Boolean, default: false }, renderTitle: {} }, setup(__props) { const props = __props; const instance = vue.getCurrentInstance(); const route = vue.computed( () => instance.appContext.config.globalProperties.$route ); const breadcrumbList = vue.ref([]); vue.watchEffect(() => { var _a; const breadcrumb = ((_a = props.routes) == null ? void 0 : _a.length) ? props.routes : route.value ? route.value.matched : []; breadcrumbList.value = breadcrumb.filter((item) => { var _a2; return ((_a2 = item.meta) == null ? void 0 : _a2.hideInBreadcrumb) !== true; }); }); return (_ctx, _cache) => { return vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElBreadcrumb), vue.mergeProps(_ctx.$attrs, { class: ["plus-breadcrumb", { "no-data": breadcrumbList.value.length === 0 }] }), { default: vue.withCtx(() => [ (vue.openBlock(true), vue.createElementBlock( vue.Fragment, null, vue.renderList(breadcrumbList.value, (item) => { return vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElBreadcrumbItem), { key: item.path, class: "plus-breadcrumb-item", to: item.redirect || item.path, replace: _ctx.replace }, { default: vue.withCtx(() => { var _a; return [ _ctx.renderTitle && vue.unref(is.isFunction)(_ctx.renderTitle) ? (vue.openBlock(), vue.createBlock( vue.resolveDynamicComponent(_ctx.renderTitle), vue.normalizeProps(vue.mergeProps({ key: 0 }, vue.unref(index.removeChildrenField)(item))), null, 16 /* FULL_PROPS */ )) : _ctx.$slots["breadcrumb-item-title"] ? (vue.openBlock(), vue.createElementBlock( vue.Fragment, { key: 1 }, [ vue.createCommentVNode(" \u9762\u5305\u5C51title \u63D2\u69FD "), vue.renderSlot(_ctx.$slots, "breadcrumb-item-title", vue.normalizeProps(vue.guardReactiveProps(item))) ], 2112 /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */ )) : (vue.openBlock(), vue.createElementBlock( vue.Fragment, { key: 2 }, [ vue.createTextVNode( vue.toDisplayString(((_a = item.meta) == null ? void 0 : _a.title) || item.name || item.path), 1 /* TEXT */ ) ], 64 /* STABLE_FRAGMENT */ )) ]; }), _: 2 /* DYNAMIC */ }, 1032, ["to", "replace"]); }), 128 /* KEYED_FRAGMENT */ )) ]), _: 3 /* FORWARDED */ }, 16, ["class"]); }; } }); exports.default = _sfc_main;