Carousel add event @on-click
https://github.com/iview/iview/issues/6230
This commit is contained in:
parent
410a5fbca7
commit
bfb6931364
1 changed files with 5 additions and 2 deletions
|
@ -4,10 +4,10 @@
|
||||||
<Icon type="ios-arrow-back"></Icon>
|
<Icon type="ios-arrow-back"></Icon>
|
||||||
</button>
|
</button>
|
||||||
<div :class="[prefixCls + '-list']">
|
<div :class="[prefixCls + '-list']">
|
||||||
<div :class="[prefixCls + '-track', showCopyTrack ? '' : 'higher']" :style="trackStyles" ref="originTrack">
|
<div :class="[prefixCls + '-track', showCopyTrack ? '' : 'higher']" :style="trackStyles" ref="originTrack" @click="handleClick('currentIndex')">
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</div>
|
</div>
|
||||||
<div :class="[prefixCls + '-track', showCopyTrack ? 'higher' : '']" :style="copyTrackStyles" ref="copyTrack" v-if="loop">
|
<div :class="[prefixCls + '-track', showCopyTrack ? 'higher' : '']" :style="copyTrackStyles" ref="copyTrack" v-if="loop" @click="handleClick('copyTrackIndex')">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button type="button" :class="arrowClasses" class="right" @click="arrowEvent(1)">
|
<button type="button" :class="arrowClasses" class="right" @click="arrowEvent(1)">
|
||||||
|
@ -288,6 +288,9 @@
|
||||||
this.trackOffset = this.trackIndex * this.listWidth;
|
this.trackOffset = this.trackIndex * this.listWidth;
|
||||||
this.trackCopyOffset = this.copyTrackIndex * this.listWidth + ofs;
|
this.trackCopyOffset = this.copyTrackIndex * this.listWidth + ofs;
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
handleClick (type) {
|
||||||
|
this.$emit('on-click', this[type]);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
|
Loading…
Add table
Reference in a new issue