| 123456789101112131415161718192021222324252627282930313233343536 |
- import _extends from "@babel/runtime/helpers/esm/extends";
- import { use } from '../utils';
- var _use = use('swipe-item'),
- sfc = _use[0],
- bem = _use[1];
- export default sfc({
- data: function data() {
- return {
- offset: 0
- };
- },
- beforeCreate: function beforeCreate() {
- this.$parent.swipes.push(this);
- },
- destroyed: function destroyed() {
- this.$parent.swipes.splice(this.$parent.swipes.indexOf(this), 1);
- },
- render: function render(h) {
- var _this$$parent = this.$parent,
- vertical = _this$$parent.vertical,
- computedWidth = _this$$parent.computedWidth,
- computedHeight = _this$$parent.computedHeight;
- var style = {
- width: computedWidth + 'px',
- height: vertical ? computedHeight + 'px' : '100%',
- transform: "translate" + (vertical ? 'Y' : 'X') + "(" + this.offset + "px)"
- };
- return h("div", {
- "class": bem(),
- "style": style,
- "on": _extends({}, this.$listeners)
- }, [this.slots()]);
- }
- });
|