@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.
- package/es/back-top/BackTop.js +3 -23
- package/es/menu/menu.css +1 -1
- package/es/pull-refresh/PullRefresh.js +2 -2
- package/es/pull-refresh/props.js +3 -0
- package/es/style.css +1 -1
- package/es/utils/elements.js +15 -1
- package/es/varlet.esm.js +1269 -1268
- package/highlight/attributes.json +4 -0
- package/highlight/tags.json +1 -0
- package/highlight/web-types.json +10 -1
- package/lib/back-top/BackTop.js +1 -21
- package/lib/menu/menu.css +1 -1
- package/lib/pull-refresh/PullRefresh.js +1 -1
- package/lib/pull-refresh/props.js +3 -0
- package/lib/style.css +1 -1
- package/lib/utils/elements.js +16 -0
- package/package.json +7 -7
- package/types/pullRefresh.d.ts +1 -0
- package/umd/varlet.js +7 -7
package/es/back-top/BackTop.js
CHANGED
|
@@ -2,9 +2,9 @@ import { defineComponent, ref, onMounted, onBeforeUnmount } from 'vue';
|
|
|
2
2
|
import VarButton from '../button';
|
|
3
3
|
import VarIcon from '../icon';
|
|
4
4
|
import { props } from './props';
|
|
5
|
-
import {
|
|
5
|
+
import { throttle } from '@varlet/shared';
|
|
6
6
|
import { easeInOutCubic } from '../utils/shared';
|
|
7
|
-
import { getScrollTop, getScrollLeft, scrollTo, getParentScroller, toPxNum, toSizeUnit } from '../utils/elements';
|
|
7
|
+
import { getScrollTop, getScrollLeft, scrollTo, getParentScroller, toPxNum, toSizeUnit, getTarget } from '../utils/elements';
|
|
8
8
|
import { call, createNamespace } from '../utils/components';
|
|
9
9
|
var {
|
|
10
10
|
n,
|
|
@@ -78,28 +78,8 @@ export default defineComponent({
|
|
|
78
78
|
};
|
|
79
79
|
|
|
80
80
|
var throttleScroll = throttle(scroll, 200);
|
|
81
|
-
|
|
82
|
-
var getTarget = () => {
|
|
83
|
-
var {
|
|
84
|
-
target
|
|
85
|
-
} = props;
|
|
86
|
-
|
|
87
|
-
if (isString(target)) {
|
|
88
|
-
var el = document.querySelector(props.target);
|
|
89
|
-
|
|
90
|
-
if (!el) {
|
|
91
|
-
throw Error('[Varlet] BackTop: target element cannot found');
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
return el;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (isObject(target)) return target;
|
|
98
|
-
throw Error('[Varlet] BackTop: type of prop "target" should be a selector or an element object');
|
|
99
|
-
};
|
|
100
|
-
|
|
101
81
|
onMounted(() => {
|
|
102
|
-
target = props.target ? getTarget() : getParentScroller(backTopEl.value);
|
|
82
|
+
target = props.target ? getTarget(props.target, 'BackTop') : getParentScroller(backTopEl.value);
|
|
103
83
|
target.addEventListener('scroll', throttleScroll);
|
|
104
84
|
disabled.value = false;
|
|
105
85
|
});
|
package/es/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-
|
|
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;}
|
|
@@ -4,7 +4,7 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
|
|
|
4
4
|
|
|
5
5
|
import VarIcon from '../icon';
|
|
6
6
|
import { defineComponent, ref, computed, watch, onMounted } from 'vue';
|
|
7
|
-
import { getParentScroller, getScrollTop } from '../utils/elements';
|
|
7
|
+
import { getParentScroller, getScrollTop, getTarget } from '../utils/elements';
|
|
8
8
|
import { props } from './props';
|
|
9
9
|
import { toNumber } from '@varlet/shared';
|
|
10
10
|
import { call, createNamespace } from '../utils/components';
|
|
@@ -165,7 +165,7 @@ export default defineComponent({
|
|
|
165
165
|
}
|
|
166
166
|
});
|
|
167
167
|
onMounted(() => {
|
|
168
|
-
scroller = getParentScroller(freshNode.value);
|
|
168
|
+
scroller = props.target ? getTarget(props.target, 'PullRefresh') : getParentScroller(freshNode.value);
|
|
169
169
|
setPosition();
|
|
170
170
|
});
|
|
171
171
|
return {
|