@varlet/ui 2.5.2 → 2.5.4

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.
@@ -1283,6 +1283,10 @@
1283
1283
  "type": "boolean",
1284
1284
  "description": "是否禁用下拉刷新 默认值:false"
1285
1285
  },
1286
+ "var-pull-refresh/target": {
1287
+ "type": "string | HTMLElement",
1288
+ "description": "触发滚动的对象,如果为 undefined 会监听距离最近的一个可滚动的祖先节点 默认值:-"
1289
+ },
1286
1290
  "var-pull-refresh/animation-duration": {
1287
1291
  "type": "string | number",
1288
1292
  "description": "加载结束后回到初始位置的动画时长(ms) 默认值:300"
@@ -490,6 +490,7 @@
490
490
  "attributes": [
491
491
  "v-model",
492
492
  "disabled",
493
+ "target",
493
494
  "animation-duration",
494
495
  "success-duration",
495
496
  "bg-color",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "framework": "vue",
4
- "version": "2.5.1",
4
+ "version": "2.5.3",
5
5
  "name": "VARLET",
6
6
  "contributions": {
7
7
  "html": {
@@ -3836,6 +3836,15 @@
3836
3836
  "kind": "expression"
3837
3837
  }
3838
3838
  },
3839
+ {
3840
+ "name": "target",
3841
+ "description": "触发滚动的对象,如果为 undefined 会监听距离最近的一个可滚动的祖先节点",
3842
+ "default": "-",
3843
+ "value": {
3844
+ "type": "string | HTMLElement",
3845
+ "kind": "expression"
3846
+ }
3847
+ },
3839
3848
  {
3840
3849
  "name": "animation-duration",
3841
3850
  "description": "加载结束后回到初始位置的动画时长(ms)",
@@ -95,28 +95,8 @@ var _default = (0, _vue.defineComponent)({
95
95
  };
96
96
 
97
97
  var throttleScroll = (0, _shared.throttle)(scroll, 200);
98
-
99
- var getTarget = () => {
100
- var {
101
- target
102
- } = props;
103
-
104
- if ((0, _shared.isString)(target)) {
105
- var el = document.querySelector(props.target);
106
-
107
- if (!el) {
108
- throw Error('[Varlet] BackTop: target element cannot found');
109
- }
110
-
111
- return el;
112
- }
113
-
114
- if ((0, _shared.isObject)(target)) return target;
115
- throw Error('[Varlet] BackTop: type of prop "target" should be a selector or an element object');
116
- };
117
-
118
98
  (0, _vue.onMounted)(() => {
119
- target = props.target ? getTarget() : (0, _elements.getParentScroller)(backTopEl.value);
99
+ target = props.target ? (0, _elements.getTarget)(props.target, 'BackTop') : (0, _elements.getParentScroller)(backTopEl.value);
120
100
  target.addEventListener('scroll', throttleScroll);
121
101
  disabled.value = false;
122
102
  });
package/lib/menu/menu.css CHANGED
@@ -1 +1 @@
1
- :root { --menu-background-color: #fff;}.var-menu-enter-from,.var-menu-leave-to { opacity: 0;}.var-menu-enter-active,.var-menu-leave-active { transition-property: opacity; transition-duration: 0.25s;}.var-menu { display: inline-block;}.var-menu__menu { overflow: auto;}.var-menu--menu-background-color { background: var(--menu-background-color); transition: opacity 0.25s, background-color 0.25s;}
1
+ :root { --menu-background-color: #fff;}.var-menu-enter-from,.var-menu-leave-to { opacity: 0;}.var-menu-enter-active,.var-menu-leave-active { transition-property: opacity; transition-duration: 0.25s;}.var-menu { display: inline-block;}.var-menu--menu-background-color { background: var(--menu-background-color); transition: opacity 0.25s, background-color 0.25s;}
@@ -180,7 +180,7 @@ var _default = (0, _vue.defineComponent)({
180
180
  }
181
181
  });
182
182
  (0, _vue.onMounted)(() => {
183
- scroller = (0, _elements.getParentScroller)(freshNode.value);
183
+ scroller = props.target ? (0, _elements.getTarget)(props.target, 'PullRefresh') : (0, _elements.getParentScroller)(freshNode.value);
184
184
  setPosition();
185
185
  });
186
186
  return {
@@ -40,6 +40,9 @@ var props = {
40
40
  successColor: {
41
41
  type: String
42
42
  },
43
+ target: {
44
+ type: [String, Object]
45
+ },
43
46
  onRefresh: (0, _components.defineListenerProp)(),
44
47
  'onUpdate:modelValue': (0, _components.defineListenerProp)()
45
48
  };