Compare commits

..

No commits in common. "bb337264590de4fe0f557025960103bfa1ec58ce" and "d1557fea04d7a916d6d4b66e33828a9eb24618fb" have entirely different histories.

3 changed files with 29 additions and 49 deletions

View File

@ -112,7 +112,8 @@
outline: none; outline: none;
width: 100%; width: 100%;
font-size: 14px; font-size: 14px;
color: #333; color: #999;
border-bottom: 1px solid #ddd;
} }
.order-button { .order-button {

View File

@ -2,50 +2,10 @@
<view class="container"> <view class="container">
<ChatMainList /> <ChatMainList />
</view> </view>
<!-- 日历组件 -->
<Calender
:visible="calendarVisible"
mode="single"
:default-value="selectedDate"
@close="handleCalendarClose"
@select="handleDateSelect"
/>
</template> </template>
<script setup> <script setup>
import { ref, onMounted, onUnmounted } from "vue";
import ChatMainList from "../chat/ChatMainList.vue"; import ChatMainList from "../chat/ChatMainList.vue";
import Calender from "@/components/Calender/index.vue";
const calendarVisible = ref(false);
const selectedDate = ref("");
//
const handleCalendarClose = () => {
calendarVisible.value = false;
};
//
const handleDateSelect = (data) => {
selectedDate.value = data.date;
calendarVisible.value = false;
console.log("选择的日期:", data.date);
uni.$emit("selectCalendarDate", selectedDate.value); //
};
uni.$on("openCalendar", () => {
calendarVisible.value = true;
});
onUnmounted(() => {
// uni.$off('openCalendar')
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -22,17 +22,41 @@
<text class="calendar-text">日历</text> <text class="calendar-text">日历</text>
</view> </view>
</view> </view>
<!-- 日历组件 -->
<Calender
:visible="calendarVisible"
mode="single"
:default-value="selectedDate"
@close="handleCalendarClose"
@select="handleDateSelect"
/>
</view> </view>
</template> </template>
<script setup> <script setup>
import { ref, onMounted } from "vue"; import { ref, onMounted } from "vue";
const emit = defineEmits(["update:date"]); // const emit = defineEmits(["update:date"]); //
import Calender from "@/components/Calender/index.vue";
const activeIndex = ref(2); // const activeIndex = ref(2); //
const dates = ref([]); const dates = ref([]);
const calendarVisible = ref(false);
const selectedDate = ref("");
//
const handleCalendarClose = () => {
calendarVisible.value = false;
};
//
const handleDateSelect = (data) => {
selectedDate.value = data.date;
calendarVisible.value = false;
console.log("选择的日期:", data.date);
emit("update:date", { fullDate: selectedDate.value }); //
};
// //
const initDates = () => { const initDates = () => {
const today = new Date(); const today = new Date();
@ -58,12 +82,7 @@ const selectDate = (index) => {
}; };
const openCalendar = () => { const openCalendar = () => {
uni.$emit("openCalendar"); calendarVisible.value = true;
uni.$on("selectCalendarDate", (date) => {
emit("update:date", { fullDate: date });
uni.$off("selectCalendarDate");
});
}; };
onMounted(() => { onMounted(() => {