80 lines
2.0 KiB
Vue
80 lines
2.0 KiB
Vue
<script>
|
|
/** 商品分组标题:约定名称中首个 -N 后的非空文本作为徽标,其余情况完整显示原名称。 */
|
|
import "~/assets/styles/ProductGroupLabel.B1kWpFA-.css";
|
|
import { toDisplayString } from "vue";
|
|
import { createCommentVNode } from "vue";
|
|
import { computed } from "vue";
|
|
import { createElementBlock } from "vue";
|
|
import { createElementVNode } from "vue";
|
|
import { unref } from "vue";
|
|
import { defineComponent } from "vue";
|
|
import { openBlock } from "vue";
|
|
import { t as _plugin_vue_export_helper_t } from "~/lib/_plugin-vue_export-helper.js";
|
|
function l(e) {
|
|
// 只在名称和徽标两部分均存在时拆分;导出的 n 也被其他商品展示逻辑复用。
|
|
let t = typeof e == `string` ? e.trim() : ``,
|
|
n = t.indexOf(`-N`);
|
|
if (n < 0)
|
|
return {
|
|
name: t,
|
|
badge: ``,
|
|
};
|
|
let r = t.slice(0, n).trim(),
|
|
i = t.slice(n + 2).trim();
|
|
return r && i
|
|
? {
|
|
name: r,
|
|
badge: i,
|
|
}
|
|
: {
|
|
name: t,
|
|
badge: ``,
|
|
};
|
|
}
|
|
var u = {
|
|
class: `product-group-label`,
|
|
},
|
|
d = {
|
|
class: `product-group-name`,
|
|
},
|
|
f = {
|
|
key: 0,
|
|
class: `product-group-badge`,
|
|
},
|
|
p = Object.assign(
|
|
_plugin_vue_export_helper_t(
|
|
defineComponent({
|
|
__name: `ProductGroupLabel`,
|
|
props: {
|
|
name: {},
|
|
},
|
|
setup(o) {
|
|
let c = o,
|
|
p = computed(() => l(c.name));
|
|
return (n, o) => (
|
|
openBlock(),
|
|
createElementBlock(`span`, u, [
|
|
createElementVNode(`span`, d, toDisplayString(unref(p).name), 1),
|
|
unref(p).badge
|
|
? (openBlock(),
|
|
createElementBlock(
|
|
`span`,
|
|
f,
|
|
toDisplayString(unref(p).badge),
|
|
1,
|
|
))
|
|
: createCommentVNode(``, !0),
|
|
])
|
|
);
|
|
},
|
|
}),
|
|
[[`__scopeId`, `data-v-6806c62d`]],
|
|
),
|
|
{
|
|
__name: `ProductGroupLabel`,
|
|
},
|
|
);
|
|
export { l as n };
|
|
export default p;
|
|
</script>
|