需要在包一层,像下面这样
<div class="collect" v-if="null==collectedForm.id" @click="updateCollectedMethod(detail.id)">
<i class="el-icon-star-off"></i>
收藏
< /div>
import { userListCollected} from "@/api/web/collected";
methods: {
//查看收藏
checkCollected(id){
this.loading = true;
userListCollected({cid:id,cType:1}).then(response => {
if(response.rows.length>0){
this.collectedForm = response.rows[0];
}else{
this.collectedForm ={};
}
this.loading = false;
});
},
}