chore(Swipe): use relation mixin

This commit is contained in:
chenjiahan
2020-03-22 07:24:43 +08:00
parent afed270c14
commit 90cc5744e2
3 changed files with 25 additions and 29 deletions
+4 -9
View File
@@ -1,24 +1,19 @@
import { createNamespace } from '../utils';
import { ChildrenMixin } from '../mixins/relation';
const [createComponent, bem] = createNamespace('swipe-item');
export default createComponent({
mixins: [ChildrenMixin('vanSwipe')],
data() {
return {
offset: 0,
};
},
beforeCreate() {
this.$parent.swipes.push(this);
},
destroyed() {
this.$parent.swipes.splice(this.$parent.swipes.indexOf(this), 1);
},
render() {
const { vertical, computedWidth, computedHeight } = this.$parent;
const { vertical, computedWidth, computedHeight } = this.parent;
const style = {
width: computedWidth + 'px',