comic-plus
Version:
<p align="center"> <img width="200px" src="./logo.png"/> </p>
75 lines (74 loc) • 2.91 kB
JavaScript
import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, unref, normalizeStyle, createElementVNode, createBlock, resolveDynamicComponent, toDisplayString, renderSlot, createTextVNode } from "vue";
import { stepItemProps } from "./item.props.mjs";
import { useStepItem } from "./use-item.mjs";
const _hoisted_1 = { class: "cu-step-item__header" };
const _hoisted_2 = {
key: 0,
class: "cu-step-item__icon"
};
const _hoisted_3 = {
key: 1,
class: "cu-step-item__text"
};
const _hoisted_4 = { class: "cu-step-item__main" };
const _hoisted_5 = { class: "cu-step-item__title" };
const _hoisted_6 = { class: "cu-step-item__content" };
const _sfc_main = /* @__PURE__ */ defineComponent({
...{
name: "CuStepItem"
},
__name: "item",
props: stepItemProps,
setup(__props) {
const props = __props;
const { instance, itemList, currentIndex, isFinish, isCurrent, currentIcon, maxWidth, injectProps } = useStepItem(props);
const style = computed(() => {
if (injectProps.direction === "vertical") {
if (instance.uid === itemList.value[itemList.value.length - 1]) return void 0;
return {
flexBasis: 100 / (itemList.value.length - 1) + "%"
};
} else if (injectProps.center) {
return {
flexBasis: 100 / itemList.value.length + "%"
};
} else if (instance.uid === itemList.value[itemList.value.length - 1]) {
return {
maxWidth: maxWidth.value + "%"
};
} else {
return {
flexBasis: 100 / (itemList.value.length - 1) + "%"
};
}
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
class: normalizeClass(["cu-step-item", { "is-finish": unref(isFinish), "is-active": unref(isCurrent) && !_ctx.error, error: _ctx.error, "is-center": unref(injectProps).center }]),
style: normalizeStyle(style.value)
}, [
createElementVNode("div", _hoisted_1, [
unref(currentIcon) ? (openBlock(), createElementBlock("span", _hoisted_2, [
(openBlock(), createBlock(resolveDynamicComponent(unref(currentIcon))))
])) : (openBlock(), createElementBlock("span", _hoisted_3, toDisplayString(unref(currentIndex) + 1), 1)),
_cache[0] || (_cache[0] = createElementVNode("span", { class: "cu-step-item__line" }, null, -1))
]),
createElementVNode("div", _hoisted_4, [
createElementVNode("div", _hoisted_5, [
renderSlot(_ctx.$slots, "title", {}, () => [
createTextVNode(toDisplayString(_ctx.title), 1)
])
]),
createElementVNode("div", _hoisted_6, [
renderSlot(_ctx.$slots, "default", {}, () => [
createTextVNode(toDisplayString(_ctx.content), 1)
])
])
])
], 6);
};
}
});
export {
_sfc_main as default
};