1. 监听ref 变量
const selected = ref(0)
watch(selected, (index) => {
emit("onChange", tabList.value[index])
})
watch(
() => locationStore.selectCityinfo,
() => {
getCinemaList(0)
}
);
2.reactive
const filterInfo = reactive({
// areaId: null,
cinemaLineId: null,
cinemaName: null,
areaId: getSelectCityinfo.value.id,
filmId: null,
showDate: "",
cinemaLat: getCitylatlng.value[0],
cinemaLng: getCitylatlng.value[1]
})
watch(filterInfo, () => {
pageInfo.value.currentPage = 1
pageInfo.value.pageSize = 10
getCinemaList(0)
});
---------------------------------------
const state = reactive({
searchValue: ''
});
watch(() => state.searchValue, (newValue, oldValue) => {
console.log(newValue, oldValue);
if (!newValue) {
emit("onhandleClear")
}
})