鼠标点击出现小心心

下面介绍一下我自己查阅资料以及某位大佬的博文进行总结的鼠标点击特效

 

上源码   最主要的部分

<template>
	<div>
		<div id="lovesBgc" ></div>
		<!-- 点击biubiubiu小心心  start-->
		<div v-for="(item,index) in loves" v-bind:key="index"  v-bind:ref="loves[index].count"  class="img"
		v-bind:style="item.top+item.left+item.scale+item.opacity">
			<div class="left"  v-bind:style="item.childBgc"></div>
			<div class="right" v-bind:style="item.childBgc"></div>
			<div class="under" v-bind:style="item.childBgc"></div>
			<div class="text"> {
  {text[loves[index].textIndex]}}</div>
		</div>
		<!-- 点击biubiubiu小心心  stop-->
		
		<!-- 上升气泡   start-->
		<div class="bubbels">
			<div v-for="(item,index) in bubbles" v-bind:key="index" class="bubble"
				v-bind:style="item.color+item.width+item.height+item.left+
				item.delay+item.duration">
			</div>
		</div>
		<!-- 上升气泡   stop-->
	</div>
</template>

<script>
	export default {
	  data(){
			const text = ["小哥哥你好呀~", "我好喜欢你~", "我爱你~", "哎呀呀~", "mua~", "小姐姐你好呀", "想你", "咦~"];
			const loves = [];
			const bubbles = [];
			return {
				text : text,  //小心心上边显示的文字 
				textIndex : 0,  //小心心数组下标
				loves : loves, //小心心样式
				count : 0,   //创建元素个数
				bubbles : bubbles,
			}
		},
		methods: {
		   // 创建小心心
			createLoves(event,a,b) {//这个地方 a,b代表定位文字和小心
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值