1
0
mirror of https://gitee.com/vant-contrib/vant.git synced 2025-04-06 03:57:59 +08:00
neverland 4dfa56e796 [bugfix] Swipe shouid re initialize when item changes ()
* [Document] add english document of Checkbox

* [Document] add english document of Field

* [Document] add english document of NumberKeyboard

* [bugfix] NumberKeyboard should not dispaly title when title is empty

* [Document] add english document of PasswordInput

* [Document] add english document of Radio

* [document] add english document of Switch

* [bugfix] remove redundent styles in english document

* [Document] fix details

* fix Switch test cases

* [bugfix] Swipe shouid reinitialize when item changes
2017-10-12 08:19:18 -05:00

36 lines
555 B
Vue

<template>
<div class="van-swipe-item" :style="style">
<slot></slot>
</div>
</template>
<script>
export default {
name: 'van-swipe-item',
beforeCreate() {
this.$parent.swipes.push(this);
},
data() {
return {
offset: 0,
index: this.$parent.swipes.indexOf(this)
};
},
computed: {
style() {
return {
width: this.$parent.width + 'px',
transform: `translate3d(${this.offset}px, 0, 0)`
};
}
},
destroyed() {
this.$parent.swipes.splice(this.index, 1);
}
};
</script>