vuux
Version:
Vue3 Nuxt3 Nuxt4 组件库
42 lines (41 loc) • 1.17 kB
JavaScript
import { defineComponent as d, createElementBlock as t, openBlock as o, normalizeStyle as g, Fragment as s, renderList as u, unref as y, renderSlot as l, createTextVNode as a, toDisplayString as i } from "vue";
import { useHighlight as x } from "./hook/useHighlight.mjs";
const f = {
key: 0,
class: "is-key"
}, m = { key: 1 }, S = /* @__PURE__ */ d({
name: "Highlight",
__name: "index",
props: {
content: {},
keyWords: {},
ignoreCase: { type: Boolean },
color: { default: "var(--app-theme)" }
},
setup(p) {
const r = p, { renderTexts: c } = x(r);
return (n, _) => (o(), t("div", {
class: "app-highlight",
style: g("--highlight-color:" + r.color)
}, [
(o(!0), t(s, null, u(y(c), (e, h) => (o(), t(s, { key: h }, [
e.isKey ? (o(), t("span", f, [
l(n.$slots, "light", {
text: e.text
}, () => [
a(i(e.text), 1)
])
])) : (o(), t("span", m, [
l(n.$slots, "default", {
text: e.text
}, () => [
a(i(e.text), 1)
])
]))
], 64))), 128))
], 4));
}
});
export {
S as default
};