修改本地请求地址
This commit is contained in:
1
node_modules/@vant/weapp/dist/sticky/index.d.ts
generated
vendored
1
node_modules/@vant/weapp/dist/sticky/index.d.ts
generated
vendored
@@ -1 +0,0 @@
|
||||
export {};
|
120
node_modules/@vant/weapp/dist/sticky/index.js
generated
vendored
120
node_modules/@vant/weapp/dist/sticky/index.js
generated
vendored
@@ -1,120 +0,0 @@
|
||||
import { getRect } from '../common/utils';
|
||||
import { VantComponent } from '../common/component';
|
||||
import { isDef } from '../common/validator';
|
||||
import { pageScrollMixin } from '../mixins/page-scroll';
|
||||
const ROOT_ELEMENT = '.van-sticky';
|
||||
VantComponent({
|
||||
props: {
|
||||
zIndex: {
|
||||
type: Number,
|
||||
value: 99,
|
||||
},
|
||||
offsetTop: {
|
||||
type: Number,
|
||||
value: 0,
|
||||
observer: 'onScroll',
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
observer: 'onScroll',
|
||||
},
|
||||
container: {
|
||||
type: null,
|
||||
observer: 'onScroll',
|
||||
},
|
||||
scrollTop: {
|
||||
type: null,
|
||||
observer(val) {
|
||||
this.onScroll({ scrollTop: val });
|
||||
},
|
||||
},
|
||||
},
|
||||
mixins: [
|
||||
pageScrollMixin(function (event) {
|
||||
if (this.data.scrollTop != null) {
|
||||
return;
|
||||
}
|
||||
this.onScroll(event);
|
||||
}),
|
||||
],
|
||||
data: {
|
||||
height: 0,
|
||||
fixed: false,
|
||||
transform: 0,
|
||||
},
|
||||
mounted() {
|
||||
this.onScroll();
|
||||
},
|
||||
methods: {
|
||||
onScroll({ scrollTop } = {}) {
|
||||
const { container, offsetTop, disabled } = this.data;
|
||||
if (disabled) {
|
||||
this.setDataAfterDiff({
|
||||
fixed: false,
|
||||
transform: 0,
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.scrollTop = scrollTop || this.scrollTop;
|
||||
if (typeof container === 'function') {
|
||||
Promise.all([getRect(this, ROOT_ELEMENT), this.getContainerRect()])
|
||||
.then(([root, container]) => {
|
||||
if (offsetTop + root.height > container.height + container.top) {
|
||||
this.setDataAfterDiff({
|
||||
fixed: false,
|
||||
transform: container.height - root.height,
|
||||
});
|
||||
}
|
||||
else if (offsetTop >= root.top) {
|
||||
this.setDataAfterDiff({
|
||||
fixed: true,
|
||||
height: root.height,
|
||||
transform: 0,
|
||||
});
|
||||
}
|
||||
else {
|
||||
this.setDataAfterDiff({ fixed: false, transform: 0 });
|
||||
}
|
||||
})
|
||||
.catch(() => { });
|
||||
return;
|
||||
}
|
||||
getRect(this, ROOT_ELEMENT).then((root) => {
|
||||
if (!isDef(root) || (!root.width && !root.height)) {
|
||||
return;
|
||||
}
|
||||
if (offsetTop >= root.top) {
|
||||
this.setDataAfterDiff({ fixed: true, height: root.height });
|
||||
this.transform = 0;
|
||||
}
|
||||
else {
|
||||
this.setDataAfterDiff({ fixed: false });
|
||||
}
|
||||
});
|
||||
},
|
||||
setDataAfterDiff(data) {
|
||||
wx.nextTick(() => {
|
||||
const diff = Object.keys(data).reduce((prev, key) => {
|
||||
if (data[key] !== this.data[key]) {
|
||||
prev[key] = data[key];
|
||||
}
|
||||
return prev;
|
||||
}, {});
|
||||
if (Object.keys(diff).length > 0) {
|
||||
this.setData(diff);
|
||||
}
|
||||
this.$emit('scroll', {
|
||||
scrollTop: this.scrollTop,
|
||||
isFixed: data.fixed || this.data.fixed,
|
||||
});
|
||||
});
|
||||
},
|
||||
getContainerRect() {
|
||||
const nodesRef = this.data.container();
|
||||
if (!nodesRef) {
|
||||
return Promise.reject(new Error('not found container'));
|
||||
}
|
||||
return new Promise((resolve) => nodesRef.boundingClientRect(resolve).exec());
|
||||
},
|
||||
},
|
||||
});
|
3
node_modules/@vant/weapp/dist/sticky/index.json
generated
vendored
3
node_modules/@vant/weapp/dist/sticky/index.json
generated
vendored
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"component": true
|
||||
}
|
8
node_modules/@vant/weapp/dist/sticky/index.wxml
generated
vendored
8
node_modules/@vant/weapp/dist/sticky/index.wxml
generated
vendored
@@ -1,8 +0,0 @@
|
||||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
<wxs src="./index.wxs" module="computed" />
|
||||
|
||||
<view class="custom-class van-sticky" style="{{ computed.containerStyle({ fixed, height, zIndex }) }}">
|
||||
<view class="{{ utils.bem('sticky-wrap', { fixed }) }}" style="{{ computed.wrapStyle({ fixed, offsetTop, transform, zIndex }) }}">
|
||||
<slot />
|
||||
</view>
|
||||
</view>
|
25
node_modules/@vant/weapp/dist/sticky/index.wxs
generated
vendored
25
node_modules/@vant/weapp/dist/sticky/index.wxs
generated
vendored
@@ -1,25 +0,0 @@
|
||||
/* eslint-disable */
|
||||
var style = require('../wxs/style.wxs');
|
||||
var addUnit = require('../wxs/add-unit.wxs');
|
||||
|
||||
function wrapStyle(data) {
|
||||
return style({
|
||||
transform: data.transform
|
||||
? 'translate3d(0, ' + data.transform + 'px, 0)'
|
||||
: '',
|
||||
top: data.fixed ? addUnit(data.offsetTop) : '',
|
||||
'z-index': data.zIndex,
|
||||
});
|
||||
}
|
||||
|
||||
function containerStyle(data) {
|
||||
return style({
|
||||
height: data.fixed ? addUnit(data.height) : '',
|
||||
'z-index': data.zIndex,
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
wrapStyle: wrapStyle,
|
||||
containerStyle: containerStyle,
|
||||
};
|
1
node_modules/@vant/weapp/dist/sticky/index.wxss
generated
vendored
1
node_modules/@vant/weapp/dist/sticky/index.wxss
generated
vendored
@@ -1 +0,0 @@
|
||||
@import '../common/index.wxss';.van-sticky{position:relative}.van-sticky-wrap--fixed{left:0;position:fixed;right:0}
|
Reference in New Issue
Block a user