UNPKG

vant-fork

Version:

Lightweight Mobile UI Components built on Vue

40 lines (37 loc) 1.03 kB
import create from '../utils/create'; export default create({ render: function render() { var _vm = this; var _h = _vm.$createElement; var _c = _vm._self._c || _h; return _c('div', { class: _vm.b(), style: _vm.style }, [_vm._t("default")], 2); }, name: 'swipe-item', data: function data() { return { offset: 0 }; }, computed: { style: function style() { var _this$$parent = this.$parent, vertical = _this$$parent.vertical, computedWidth = _this$$parent.computedWidth, computedHeight = _this$$parent.computedHeight; return { width: computedWidth + 'px', height: vertical ? computedHeight + 'px' : '100%', transform: "translate" + (vertical ? 'Y' : 'X') + "(" + this.offset + "px)" }; } }, beforeCreate: function beforeCreate() { this.$parent.swipes.push(this); }, destroyed: function destroyed() { this.$parent.swipes.splice(this.$parent.swipes.indexOf(this), 1); } });