zartui 2.0.78 → 2.0.79-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/es/index.js CHANGED
@@ -74,7 +74,7 @@ import Tag from './tag';
74
74
  import Timeline from './timeline';
75
75
  import Toast from './toast';
76
76
  import Uploader from './uploader';
77
- var version = '2.0.78';
77
+ var version = '2.0.79-beta.1';
78
78
 
79
79
  function install(Vue) {
80
80
  var components = [ActionSheet, Area, Avatar, BackTop, Badge, Button, Calendar, Cascader, Cell, CellGroup, Checkbox, CheckboxGroup, Col, Collapse, CollapseItem, CountDown, DatetimePicker, Dialog, Divider, DropdownItem, DropdownMenu, Empty, Field, FoldDialog, Form, Grid, GridItem, HierarchySelect, Icon, Image, ImagePreview, IndexAnchor, IndexBar, Info, Lazyload, List, Loading, Locale, MediaPicker, MediaPlayer, MultiplePicker, NavBar, NoticeBar, NumberKeyboard, Overlay, PasswordInput, Picker, Popover, Popup, PullRefresh, Radio, RadioGroup, Rate, Row, Search, Signature, Skeleton, Slider, Step, Stepper, Steps, Sticky, Swipe, SwipeCell, SwipeItem, Switch, SwitchCell, Tab, Tabbar, TabbarItem, Table, Tabs, Tag, Timeline, Toast, Uploader];
@@ -1,7 +1,7 @@
1
1
  // Utils
2
2
  import { createNamespace } from '../utils';
3
3
  import { preventDefault } from '../utils/dom/event';
4
- import { getScrollTop, getScroller } from '../utils/dom/scroll'; // Mixins
4
+ import { getScrollTop, getScroller, getTargetDom } from '../utils/dom/scroll'; // Mixins
5
5
 
6
6
  import { TouchMixin } from '../mixins/touch'; // Components
7
7
 
@@ -21,21 +21,25 @@ export default createComponent({
21
21
  successText: String,
22
22
  pullingText: {
23
23
  type: String,
24
- default: "下拉即可刷新..."
24
+ default: '下拉即可刷新...'
25
25
  },
26
26
  loosingText: {
27
27
  type: String,
28
- default: "释放即可刷新..."
28
+ default: '释放即可刷新...'
29
29
  },
30
30
  loadingText: {
31
31
  type: String,
32
- default: "加载中..."
32
+ default: '加载中...'
33
33
  },
34
34
  pullDistance: [Number, String],
35
35
  value: {
36
36
  type: Boolean,
37
37
  required: true
38
38
  },
39
+ scrollElement: {
40
+ type: [String, Function, HTMLElement],
41
+ required: false
42
+ },
39
43
  successDuration: {
40
44
  type: [Number, String],
41
45
  default: 500
@@ -66,6 +70,17 @@ export default createComponent({
66
70
  height: this.headHeight + "px"
67
71
  };
68
72
  }
73
+ },
74
+ scrollEl: function scrollEl() {
75
+ if (this.scrollElement) {
76
+ if (this.scrollElement) {
77
+ return getTargetDom(this.scrollElement);
78
+ }
79
+
80
+ return this.scrollElement();
81
+ }
82
+
83
+ return getScroller(this.$el);
69
84
  }
70
85
  },
71
86
  watch: {
@@ -83,7 +98,6 @@ export default createComponent({
83
98
  },
84
99
  mounted: function mounted() {
85
100
  this.bindTouchEvent(this.$refs.track);
86
- this.scrollEl = getScroller(this.$el);
87
101
  },
88
102
  methods: {
89
103
  checkPullStart: function checkPullStart(event) {
@@ -66,4 +66,21 @@ export function getVisibleTop(el) {
66
66
  }
67
67
 
68
68
  return el.getBoundingClientRect().top;
69
- }
69
+ }
70
+ export var getTargetDom = function getTargetDom(target) {
71
+ if (target) {
72
+ if (typeof target === 'string') {
73
+ return document.querySelectorAll(target)[0];
74
+ }
75
+
76
+ if (typeof target === 'function') {
77
+ return target();
78
+ }
79
+
80
+ if (typeof target === 'object' && target instanceof window.HTMLElement) {
81
+ return target;
82
+ }
83
+ }
84
+
85
+ return document.body;
86
+ };
package/lib/index.js CHANGED
@@ -309,7 +309,7 @@ exports.Toast = _toast.default;
309
309
  var _uploader = _interopRequireDefault(require("./uploader"));
310
310
 
311
311
  exports.Uploader = _uploader.default;
312
- var version = '2.0.78';
312
+ var version = '2.0.79-beta.1';
313
313
  exports.version = version;
314
314
 
315
315
  function install(Vue) {
@@ -33,21 +33,25 @@ var _default = createComponent({
33
33
  successText: String,
34
34
  pullingText: {
35
35
  type: String,
36
- default: "下拉即可刷新..."
36
+ default: '下拉即可刷新...'
37
37
  },
38
38
  loosingText: {
39
39
  type: String,
40
- default: "释放即可刷新..."
40
+ default: '释放即可刷新...'
41
41
  },
42
42
  loadingText: {
43
43
  type: String,
44
- default: "加载中..."
44
+ default: '加载中...'
45
45
  },
46
46
  pullDistance: [Number, String],
47
47
  value: {
48
48
  type: Boolean,
49
49
  required: true
50
50
  },
51
+ scrollElement: {
52
+ type: [String, Function, HTMLElement],
53
+ required: false
54
+ },
51
55
  successDuration: {
52
56
  type: [Number, String],
53
57
  default: 500
@@ -78,6 +82,17 @@ var _default = createComponent({
78
82
  height: this.headHeight + "px"
79
83
  };
80
84
  }
85
+ },
86
+ scrollEl: function scrollEl() {
87
+ if (this.scrollElement) {
88
+ if (this.scrollElement) {
89
+ return (0, _scroll.getTargetDom)(this.scrollElement);
90
+ }
91
+
92
+ return this.scrollElement();
93
+ }
94
+
95
+ return (0, _scroll.getScroller)(this.$el);
81
96
  }
82
97
  },
83
98
  watch: {
@@ -95,7 +110,6 @@ var _default = createComponent({
95
110
  },
96
111
  mounted: function mounted() {
97
112
  this.bindTouchEvent(this.$refs.track);
98
- this.scrollEl = (0, _scroll.getScroller)(this.$el);
99
113
  },
100
114
  methods: {
101
115
  checkPullStart: function checkPullStart(event) {
@@ -9,6 +9,7 @@ exports.setRootScrollTop = setRootScrollTop;
9
9
  exports.getElementTop = getElementTop;
10
10
  exports.getVisibleHeight = getVisibleHeight;
11
11
  exports.getVisibleTop = getVisibleTop;
12
+ exports.getTargetDom = void 0;
12
13
 
13
14
  function isWindow(val) {
14
15
  return val === window;
@@ -86,4 +87,24 @@ function getVisibleTop(el) {
86
87
  }
87
88
 
88
89
  return el.getBoundingClientRect().top;
89
- }
90
+ }
91
+
92
+ var getTargetDom = function getTargetDom(target) {
93
+ if (target) {
94
+ if (typeof target === 'string') {
95
+ return document.querySelectorAll(target)[0];
96
+ }
97
+
98
+ if (typeof target === 'function') {
99
+ return target();
100
+ }
101
+
102
+ if (typeof target === 'object' && target instanceof window.HTMLElement) {
103
+ return target;
104
+ }
105
+ }
106
+
107
+ return document.body;
108
+ };
109
+
110
+ exports.getTargetDom = getTargetDom;