|
|
<template>
|
|
|
<Scroll ref="scroll" class="scroll-view" v-bind="attrMerge" v-on="listenerMerge">
|
|
|
<Scroll
|
|
|
ref="scroll"
|
|
|
class="scroll-view"
|
|
|
v-bind="attrMerge"
|
|
|
v-on="listenerMerge"
|
|
|
>
|
|
|
<slot slot="default"></slot>
|
|
|
<template slot="pulldown" slot-scope="props">
|
|
|
<div v-if="props.pullDownRefresh"
|
|
|
<!-- <div
|
|
|
v-if="props.pullDownRefresh"
|
|
|
class="pulldown-wrapper"
|
|
|
:style="props.pullDownStyle">
|
|
|
:style="props.pullDownStyle"
|
|
|
>
|
|
|
<div class="pulldown-content">
|
|
|
<div v-show="props.beforePullDown">
|
|
|
<div id="beforePullDown"></div>
|
...
|
...
|
@@ -13,37 +20,35 @@ |
|
|
<div id="afterPullDown"></div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div> -->
|
|
|
</template>
|
|
|
</Scroll>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import {Scroll} from 'cube-ui';
|
|
|
import { Scroll } from "cube-ui";
|
|
|
|
|
|
export default {
|
|
|
name: 'ScrollView',
|
|
|
name: "ScrollView",
|
|
|
mounted() {
|
|
|
this.$nextTick(() => {
|
|
|
this._initLottie();
|
|
|
// this._initLottie();
|
|
|
});
|
|
|
},
|
|
|
computed: {
|
|
|
attrMerge() {
|
|
|
return Object.assign({},
|
|
|
return Object.assign(
|
|
|
{},
|
|
|
{
|
|
|
scrollEvents: ['scroll']
|
|
|
scrollEvents: ["scroll"]
|
|
|
},
|
|
|
this.$attrs,
|
|
|
this.$attrs
|
|
|
);
|
|
|
},
|
|
|
listenerMerge() {
|
|
|
return Object.assign({},
|
|
|
this.$listeners,
|
|
|
{
|
|
|
return Object.assign({}, this.$listeners, {
|
|
|
scroll: this.onScroll.bind(this)
|
|
|
}
|
|
|
);
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
...
|
...
|
@@ -57,31 +62,31 @@ export default { |
|
|
this.lottieBefore.goToAndStop(0);
|
|
|
}
|
|
|
}
|
|
|
this.$emit('scroll', pos);
|
|
|
this.$emit("scroll", pos);
|
|
|
},
|
|
|
forceUpdate(dirty) {
|
|
|
this.$refs.scroll.forceUpdate(dirty);
|
|
|
},
|
|
|
_initLottie() {
|
|
|
import(/* webpackChunkName: "lottie-web" */ 'lottie-web').then(lottie => {
|
|
|
import(/* webpackChunkName: "lottie-web" */ "lottie-web").then(lottie => {
|
|
|
this.lottieBefore = lottie.loadAnimation({
|
|
|
container: document.getElementById('beforePullDown'), // the dom element that will contain the animation
|
|
|
renderer: 'svg',
|
|
|
container: document.getElementById("beforePullDown"), // the dom element that will contain the animation
|
|
|
renderer: "svg",
|
|
|
loop: false,
|
|
|
autoplay: false,
|
|
|
path: 'https://cdn.yoho.cn/mapp/lottie/ufo-pull-1227.json' // the path to the animation json
|
|
|
path: "https://cdn.yoho.cn/mapp/lottie/ufo-pull-1227.json" // the path to the animation json
|
|
|
});
|
|
|
this.lottieAfter = lottie.loadAnimation({
|
|
|
container: document.getElementById('afterPullDown'), // the dom element that will contain the animation
|
|
|
renderer: 'svg',
|
|
|
container: document.getElementById("afterPullDown"), // the dom element that will contain the animation
|
|
|
renderer: "svg",
|
|
|
loop: true,
|
|
|
autoplay: true,
|
|
|
path: 'https://cdn.yoho.cn/mapp/lottie/ufo-refresh-1227.json' // the path to the animation json
|
|
|
path: "https://cdn.yoho.cn/mapp/lottie/ufo-refresh-1227.json" // the path to the animation json
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
components: {Scroll}
|
|
|
components: { Scroll }
|
|
|
};
|
|
|
</script>
|
|
|
|
...
|
...
|
|