UNPKG

@cqmcui/cqmcui

Version:

轻量级移动端 Vue2、Vue3 组件库(支持小程序开发)

51 lines (50 loc) 1.48 kB
import { inject, reactive, computed, toRefs, openBlock, createElementBlock, normalizeClass, toDisplayString } from "vue"; import { c as createComponent } from "./component-81a4c1d0.js"; import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js"; import "../locale/lang"; const { componentName, create } = createComponent("time-pannel"); const _sfc_main = create({ name: "timepannel", props: { name: { type: String, default: "" }, pannelKey: { type: [Number, String], default: 0 } }, emits: ["change"], setup: (props, context) => { const currentKey = inject("currentKey"); const state = reactive({ currentKey }); const classes = computed(() => { const prefixCls = componentName; return { [prefixCls]: true, "cqmc-time-pannel--curr": state.currentKey == props.pannelKey }; }); const handlePannel = (pannelKey) => { context.emit("change", pannelKey); }; return { ...toRefs(state), classes, handlePannel }; } }); function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("view", { class: normalizeClass(_ctx.classes), onClick: _cache[0] || (_cache[0] = ($event) => _ctx.handlePannel(_ctx.pannelKey)) }, toDisplayString(_ctx.name), 3); } const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]); export { index as default };