UNPKG

yk-element-components-v2

Version:

99 lines (98 loc) 2.97 kB
const v = (r) => r.replace(/(A-Z)g/, "-$1").toLocaleLowerCase(); function h(r, e, o, n, i, s, c, _) { var t = typeof r == "function" ? r.options : r; e && (t.render = e, t.staticRenderFns = o, t._compiled = !0), n && (t.functional = !0), s && (t._scopeId = "data-v-" + s); var l; if (c ? (l = function(a) { a = a || this.$vnode && this.$vnode.ssrContext || this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext, !a && typeof __VUE_SSR_CONTEXT__ < "u" && (a = __VUE_SSR_CONTEXT__), i && i.call(this, a), a && a._registeredComponents && a._registeredComponents.add(c); }, t._ssrRegister = l) : i && (l = _ ? function() { i.call( this, (t.functional ? this.parent : this).$root.$options.shadowRoot ); } : i), l) if (t.functional) { t._injectStyles = l; var f = t.render; t.render = function(p, d) { return l.call(d), f(p, d); }; } else { var u = t.beforeCreate; t.beforeCreate = u ? [].concat(u, l) : [l]; } return { exports: r, options: t }; } const y = { props: { data: { type: Array, required: !0, default: () => { } }, defaultActive: { type: String, default: "" }, router: { type: Boolean, default: !1 }, name: { type: String, default: "name" }, index: { type: String, default: "index" }, icon: { type: String, default: "icon" }, children: { type: String, default: "children" }, collapse: { type: Boolean, default: !0 } }, methods: { comToLine(r) { return v(r); } } }; var m = function() { var e = this, o = e._self._c; return o("el-menu", { staticClass: "el-menu-vertical-demo", attrs: { "default-active": e.defaultActive, router: e.router, collapse: e.collapse, mode: "vertical", "collapse-transition": !0 } }, [e._l(e.data, function(n, i) { return [!n[e.children] || !n[e.children].length ? o("el-menu-item", { key: i, attrs: { index: n[e.index] } }, [n[e.icon] ? o("i", { class: `el-icon-${e.comToLine(n[e.icon])}` }) : e._e(), o("span", [e._v(e._s(n[e.name]))])]) : e._e(), n[e.children] && n[e.children].length ? o("el-sub-menu", { key: i, attrs: { index: n[e.index] }, scopedSlots: e._u([{ key: "title", fn: function() { return [n[e.icon] ? o("i", { class: `el-icon-${e.comToLine(n[e.icon])}` }) : e._e(), o("span", [e._v(e._s(n[e.name]))])]; }, proxy: !0 }], null, !0) }, e._l(n[e.children], function(s, c) { return o("el-menu-item", { key: c, attrs: { index: s[e.index] } }, [n[e.icon] ? o("i", { class: `el-icon-${e.comToLine(n[e.icon])}` }) : e._e(), o("span", [e._v(e._s(s[e.name]))])]); }), 1) : e._e()]; })], 2); }, g = [], C = /* @__PURE__ */ h( y, m, g, !1, null, "0bfa9fa8", null, null ); const $ = C.exports, S = { install(r) { r.component("yk-menu", $); } }; export { S as default };