Authored by 陈峰

commit

... ... @@ -11,7 +11,7 @@ import 'statics/scss/common.scss';
import 'statics/font/iconfont.css';
import 'statics/font/ufofont.css';
const {app, router, store} = createApp(window.__INITIAL_STATE__.yoho.context);
const {app, router, store} = createApp(window.__INITIAL_STATE__ && window.__INITIAL_STATE__.yoho.context);
if (window.__INITIAL_STATE__) {
store.replaceState(window.__INITIAL_STATE__);
... ...
... ... @@ -33,6 +33,7 @@ export default {
.layout-context {
flex: 1;
overflow: hidden;
position: relative;
}
}
</style>
... ...
... ... @@ -40,7 +40,6 @@
<script>
import {BetterScroll} from 'cube-ui';
import lottie from 'lottie-web';
function getRect(el) {
if (el instanceof window.SVGElement) {
... ... @@ -171,9 +170,7 @@ export default {
mounted() {
setTimeout(() => {
this.initScroll();
setTimeout(() => {
this.pullDownInitTop = 0 - this.$refs.pulldown.clientHeight;
}, 0);
}, 20);
},
methods: {
... ... @@ -257,21 +254,28 @@ export default {
}
},
_initLottie() {
this.lottieBefore = lottie.loadAnimation({
container: document.getElementById('beforePullDown'), // the dom element that will contain the animation
renderer: 'svg',
loop: false,
autoplay: true,
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',
loop: true,
autoplay: true,
path: 'https://cdn.yoho.cn/mapp/lottie/ufo-refresh-1227.json' // the path to the animation json
});
setTimeout(() => {
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',
loop: false,
autoplay: true,
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',
loop: true,
autoplay: true,
path: 'https://cdn.yoho.cn/mapp/lottie/ufo-refresh-1227.json' // the path to the animation json
});
this.$nextTick(() => {
this.pullDownInitTop = 0 - this.$refs.pulldown.clientHeight;
console.log(this.pullDownInitTop)
});
});
}, 200);
},
_initPullDownRefresh() {
this.scroll.on('pullingDown', () => {
... ... @@ -280,6 +284,7 @@ export default {
this.$emit('pullingDown');
});
this.scroll.on('scroll', (pos) => {
console.log('scroll')
if (!this.pullDownRefresh) {
return;
}
... ... @@ -336,8 +341,11 @@ export default {
<style lang="scss" scoped>
.list-wrapper {
position: relative;
height: 100%;
position: absolute;
top: 0;
right: 0;
left: 0;
bottom: 0;
overflow: hidden;
background: #fff;
... ...
import {subscribe} from 'webpack-hot-middleware/client?dynamicPublicPath=true&path=__webpack_hmr&noInfo=true&reload=true';
subscribe(event => {
subscribe(function(event) {
if (event.action === 'reload') {
window.location.reload();
}
... ...
... ... @@ -24,7 +24,8 @@ const webpackConfig = {
resolve: {
extensions: ['.js', '.vue', '.json'],
alias: {
vue$: 'vue/dist/vue.runtime.esm.js'
vue$: 'vue/dist/vue.runtime.esm.js',
'lottie-web': 'lottie-web/build/player/lottie_light.min.js'
},
modules: [
path.join(__dirname, '../apps'),
... ...
... ... @@ -41,6 +41,12 @@ const webpackConfig = merge(baseConfig, {
chunks: 'all',
name: 'swiper',
test: /swiper/,
},
lottie: {
priority: 1,
chunks: 'all',
name: 'lottie',
test: /lottie-web/,
}
}
}
... ...