You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.2 KiB
63 lines
1.2 KiB
<template> |
|
<view class="collect" @click="follow"> |
|
<u-icon name="heart-fill" size="48" :color="checked ? '#FF9545':'#AFB5BE'"></u-icon> |
|
<u-text size="28" :color="checked ? '#FF9545':'#AFB5BE'" text="收藏" align="center"></u-text> |
|
</view> |
|
</template> |
|
|
|
<script> |
|
import { |
|
imghost |
|
} from '@/config/host.js' |
|
import api from "@/utils/functions"; |
|
import { |
|
doCollect |
|
} from "@/api/user"; |
|
|
|
export default { |
|
props: { |
|
type: { |
|
type: String, |
|
}, |
|
id: { |
|
type: [String, Number] |
|
}, |
|
is_collect: { |
|
type: [String, Number] |
|
} |
|
}, |
|
data() { |
|
return { |
|
checked:false, |
|
isLogin:false, |
|
} |
|
}, |
|
onLoad() { |
|
|
|
}, |
|
mounted() { |
|
this.checked = this.is_collect === 1; |
|
this.isLogin = !!uni.getStorageSync('user'); |
|
}, |
|
methods: { |
|
follow() { |
|
//goods=物品,house=公寓,activity=活动,project=项目 |
|
doCollect({ |
|
type: this.type, |
|
id: this.id |
|
}).then(res => { |
|
this.checked?api.success('取消成功'):api.success('收藏成功'); |
|
this.checked = !this.checked; |
|
this.$emit('update:modelValue', value) |
|
}) |
|
} |
|
}, |
|
watch: { |
|
|
|
} |
|
} |
|
</script> |
|
|
|
<style lang="scss"> |
|
@import '@/components/FooterNav/components/index.scss'; |
|
</style> |