更新记录

1.0.0(2025-12-16) 下载此版本

仅在微信小程序调试,其他端需自己调试,该组件依赖于lunar-javascript,需要下载lunar-javascript相关的node包


平台兼容性

uni-app(3.6.15)

Vue2 Vue3 Chrome Safari app-vue app-nvue Android iOS 鸿蒙
- - - - - - -
微信小程序 支付宝小程序 抖音小程序 百度小程序 快手小程序 京东小程序 鸿蒙元服务 QQ小程序 飞书小程序 快应用-华为 快应用-联盟
- - - - - - - - - - -

HCNL-CNCalendar

该组件依赖于lunar-javascript包,需要下载该包

该包官网lunar

npm i lunar-javascript
<template>
  <view class="content">
    <view class="button" @click="openSelect('lunar')">农历</view>
    <view class="button" @click="openSelect('solar')">阳历</view>
    <AppointmentCNCalendar
      :start-year="startYear"
      :end-year="endYear"
      ref="AppointmentCNCalendar"
      @confirmDate="confirmDate"
      @cancelDate="cancelDate"
    />
  </view>
</template>
<script>
import AppointmentCNCalendar from "@/components/AppointmentCNCalendar/index.vue";
export default {
  components: {
    AppointmentCNCalendar,
  },
  data() {
    return {
      // 日历起始年份
      startYear: 1950,
      // 日历结束年份
      endYear: 2100,
    };
  },
  onReady() {
  },
  methods: {
    openSelect(type) {
      this.$refs.AppointmentCNCalendar.switchCalendar(type);
      this.$refs.AppointmentCNCalendar.openPicker(true);
    },
    confirmDate(data) {
      console.log("确认选择的日期:", data);
      this.$refs.AppointmentCNCalendar.openPicker(false);
    },
    cancelDate() {
      console.log("取消选择日期");
      this.$refs.AppointmentCNCalendar.openPicker(false);
    },
  },
};
</script>
<style>
page {
  width: 100%;
  height: 100%;
}

.button {
  padding: 20rpx;
  margin: 20rpx;
  background-color: #8b5cf6;
  color: white;
  border-radius: 10rpx;
  text-align: center;
}
</style>

隐私、权限声明

1. 本插件需要申请的系统权限列表:

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

插件不采集任何数据

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

许可协议

MIT协议

暂无用户评论。