公寓详情加收藏和附近学校
This commit is contained in:
@@ -50,6 +50,7 @@ import { useRoute, useRouter } from "vue-router"
|
||||
import backToTop from "@/components/public/backToTop.vue"
|
||||
import store from "../../store/index"
|
||||
import api from "../../utils/api"
|
||||
import { ElMessage } from "element-plus"
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
@@ -214,13 +215,27 @@ const getMoreScroll = () => {
|
||||
}
|
||||
|
||||
// 处理列表的点击收藏
|
||||
const handlecollect = item => {
|
||||
console.log("item", item)
|
||||
const targetData = JSON.parse(JSON.stringify(list.value))
|
||||
console.log("targetData", targetData);
|
||||
targetData.forEach(element => {
|
||||
console.log();
|
||||
});
|
||||
const handlecollect = uniqid => {
|
||||
console.log("uniqid", uniqid)
|
||||
let targetData = {}
|
||||
let targetIndex = 0
|
||||
let token = ""
|
||||
|
||||
list.value.forEach((element, index) => {
|
||||
if (element.uniqid == uniqid) {
|
||||
targetData = element
|
||||
targetIndex = index
|
||||
token = element.token || ""
|
||||
}
|
||||
})
|
||||
|
||||
api.apartmentCollection({ token }).then(res => {
|
||||
if (res.code != 200) return
|
||||
const data = res.data
|
||||
console.log("data", data)
|
||||
list.value[targetIndex]["iscollect"] = data.status
|
||||
ElMessage.success(res.message)
|
||||
})
|
||||
}
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
|
||||
Reference in New Issue
Block a user