@tencentcloud/roomkit-web-vue3
Version:
<h1 align="center"> TUIRoomKit</h1> Conference (TUIRoomKit) is a product suitable for multi-person audio and video conversation scenarios such as business meetings, webinars, and online education. By integrating this product, you can add room management,
66 lines (65 loc) • 2.28 kB
JavaScript
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const Vue = require("vue");
const index = require("../Select/index.js");
const index$1 = require("../Option/index.js");
const _sfc_main = /* @__PURE__ */ Vue.defineComponent({
__name: "DatepickerH5",
props: {
value: {}
},
emits: ["input"],
setup(__props, { emit: __emit }) {
const props = __props;
const emit = __emit;
const currentValue = Vue.ref();
Vue.watch(
() => props.value,
(val) => {
if (!val) return;
currentValue.value = new Date(val).getTime();
},
{ immediate: true }
);
Vue.watch(currentValue, (val) => emit("input", new Date(val)), { immediate: true });
function generateYearDates(year) {
const startDate = new Date(year, 0, 1);
const endDate = new Date(year, 11, 31);
const dates = [];
const currentDate = startDate;
while (currentDate <= endDate) {
const month = currentDate.getMonth() + 1;
const day = currentDate.getDate();
dates.push(
`${year}/${month < 10 ? `0${month}` : month}/${day < 10 ? `0${day}` : day}`
);
currentDate.setDate(currentDate.getDate() + 1);
}
return dates;
}
const yearDates = generateYearDates((/* @__PURE__ */ new Date()).getFullYear()).map((item) => ({
label: item,
value: new Date(item).getTime()
}));
return (_ctx, _cache) => {
return Vue.openBlock(), Vue.createElementBlock("div", null, [
Vue.createVNode(Vue.unref(index.default), {
value: currentValue.value,
onInput: _cache[0] || (_cache[0] = ($event) => currentValue.value = $event)
}, {
default: Vue.withCtx(() => [
(Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(Vue.unref(yearDates), (item) => {
return Vue.openBlock(), Vue.createBlock(Vue.unref(index$1.default), {
key: item.value,
value: item.value,
label: item.label
}, null, 8, ["value", "label"]);
}), 128))
]),
_: 1
}, 8, ["value"])
]);
};
}
});
exports.default = _sfc_main;
;