首页 > 其他 > 详细

单个显示收藏没有收藏

时间:2019-12-21 14:16:30      阅读:75      评论:0      收藏:0      [点我收藏+]

<template> <div> <div class="box"> <img src="../assets/image/jiesuan_unchoose.png" ref="collection" @click="collect()" id="aa" > </div> </div> </template> <script> import ChooseImg from "@/assets/image/jiesuan_choose.png"; import UnChooseImg from "@/assets/image/jiesuan_unchoose.png"; export default { //循环数据,渲染到页面上 data() { return { // star: ‘books-6-2‘, //样式 status:true, } }, methods: { collect(){ if( this.$refs.collection.id=="aa"){ this.$refs.collection.src=ChooseImg; this.$refs.collection.id="bb"; this.status=false; console.log("收藏") }else{ this.$refs.collection.src=UnChooseImg; this.$refs.collection.id="aa"; this.status=true; console.log("没有收藏") } } } } </script> <style scoped> /* .ico_gou{ background: url("../assets/image/flowerdetail_star.png"); background-size: cover; } .ico_gou_on{ background: url("../assets/image/flowershoplist_star.png"); background-size: cover; } */ .box{ width: 100px; height: 100px; border:1px solid #ccc; } </style>

  

单个显示收藏没有收藏

原文:https://www.cnblogs.com/fei3/p/12076712.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!