mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
37 lines
553 B
Vue
37 lines
553 B
Vue
<template>
|
|
<div :class="b()" :style="style">
|
|
<slot />
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import create from '../utils/create';
|
|
|
|
export default create({
|
|
name: 'swipe-item',
|
|
|
|
data() {
|
|
return {
|
|
offset: 0
|
|
};
|
|
},
|
|
|
|
computed: {
|
|
style() {
|
|
return {
|
|
width: this.$parent.width + 'px',
|
|
transform: `translate(${this.offset}px, 0)`
|
|
};
|
|
}
|
|
},
|
|
|
|
beforeCreate() {
|
|
this.$parent.swipes.push(this);
|
|
},
|
|
|
|
destroyed() {
|
|
this.$parent.swipes.splice(this.$parent.swipes.indexOf(this), 1);
|
|
}
|
|
});
|
|
</script>
|