@cqmcui/cqmcui
Version:
轻量级移动端 Vue2、Vue3 组件库(支持小程序开发)
60 lines (59 loc) • 1.29 kB
JavaScript
import { reactive, computed, provide, h } from "vue";
import { c as createComponent } from "./component-81a4c1d0.js";
import "../locale/lang";
const { create, componentName } = createComponent("steps");
const _sfc_main = create({
props: {
direction: {
type: String,
default: "horizontal"
},
current: {
type: [String, Number],
default: "0"
},
progressDot: {
type: Boolean,
default: false
}
},
emits: ["click-step"],
setup(props, { emit, slots }) {
const state = reactive({
children: []
});
const classes = computed(() => {
const prefixCls = componentName;
return {
[prefixCls]: true,
[`${prefixCls}-${props.direction}`]: true,
[`${prefixCls}-dot`]: !!props.progressDot
};
});
const relation = (child) => {
child && state.children.push(child);
};
const onEmit = (index) => {
emit("click-step", index);
};
provide("parent", {
relation,
state,
props,
onEmit
});
return () => {
var _a;
return h(
"view",
{
class: classes.value
},
(_a = slots.default) == null ? void 0 : _a.call(slots)
);
};
}
});
export {
_sfc_main as default
};