【发布时间】:2018-04-06 09:59:34
【问题描述】:
我有 vuejs 组件来显示图像块。
这是我的 html,调用了 4 次组件:
<div id="activities" class="row text-center justify-content-center activities">
<zpeakimage type="art" text="{{ art_text }}" img="{{asset('images/art.png')}}" target="/list/art"></zpeakimage>
<zpeakimage type="run" text="{{ run_text }}" img="{{asset('images/run.png')}}" target="/list/run"></zpeakimage>
<zpeakimage type="eat" text="{{ eat_text }}" img="{{asset('images/eat.png')}}" target="/list/eat"></zpeakimage>
<zpeakimage type="party" text="{{ party_text }}" img="{{asset('images/party.png')}}" target="/list/party"></zpeakimage>
</div>
我的 vue-zpeakimage.js :
Vue.component('zpeakimage', {
delimiters: ['${', '}'],
props: ['type', 'text', 'img', 'target'],
template: '<div class="col-3" style="padding-top: 20px;"><h3><a @mouseover="imgBounce(type)" :title="text" :href="target"><span> <img style="width:220px;" :id="type" :src="img" :alt="text"> </span></a></h3><span> ${text} </span></div>',
methods: {
imgBounce: function doBounce(Id) {
$('#'+Id).effect('bounce', {times: 3}, 500);
}
}
});
new Vue({
el: '#activities'
});
鼠标悬停时img弹跳,但我想在鼠标悬停时无限上下动画..
【问题讨论】:
-
您实际上告诉它只反弹 3 次:
$('#'+Id).effect('bounce', {times: 3}, 500);- 将该属性更改为您需要传递给effect函数的任何内容,以使其无限循环。此外,这个问题显然是关于第三方库或一些与您提供的内容无关的代码,因此无法以合理的方式回答。
标签: vue.js