单独封装组件,把关注的内容放进去,引导父组件
进行传参
props: {
is_followed: {
type: Boolean,
required: true,
},
artclidate: {
type: Object,
required: true,
},
},
判断,用户只有在登录时才能关注作者,同时,用户也不能关注自己
async onclock() {
this.isfindinfo = true;
if (!this.$store.state.user) {
return alert("请登录");
}
try {
const aurid = this.artclidate.aut_id;
console.log(aurid);
if (this.artclidate.is_followed) {
await addinfo(aurid);
} else {
await deleteruser(aurid);
}
// this.$emit("input", this.value);
this.artclidate.is_followed = !this.artclidate.is_followed;
} catch (err) {
if (err && err.res