Authored by 陈峰

commit

@@ -11,7 +11,7 @@ import 'statics/scss/common.scss'; @@ -11,7 +11,7 @@ import 'statics/scss/common.scss';
11 import 'statics/font/iconfont.css'; 11 import 'statics/font/iconfont.css';
12 import 'statics/font/ufofont.css'; 12 import 'statics/font/ufofont.css';
13 13
14 -const {app, router, store} = createApp(window.__INITIAL_STATE__.yoho.context); 14 +const {app, router, store} = createApp(window.__INITIAL_STATE__ && window.__INITIAL_STATE__.yoho.context);
15 15
16 if (window.__INITIAL_STATE__) { 16 if (window.__INITIAL_STATE__) {
17 store.replaceState(window.__INITIAL_STATE__); 17 store.replaceState(window.__INITIAL_STATE__);
@@ -33,6 +33,7 @@ export default { @@ -33,6 +33,7 @@ export default {
33 .layout-context { 33 .layout-context {
34 flex: 1; 34 flex: 1;
35 overflow: hidden; 35 overflow: hidden;
  36 + position: relative;
36 } 37 }
37 } 38 }
38 </style> 39 </style>
@@ -40,7 +40,6 @@ @@ -40,7 +40,6 @@
40 40
41 <script> 41 <script>
42 import {BetterScroll} from 'cube-ui'; 42 import {BetterScroll} from 'cube-ui';
43 -import lottie from 'lottie-web';  
44 43
45 function getRect(el) { 44 function getRect(el) {
46 if (el instanceof window.SVGElement) { 45 if (el instanceof window.SVGElement) {
@@ -171,9 +170,7 @@ export default { @@ -171,9 +170,7 @@ export default {
171 mounted() { 170 mounted() {
172 setTimeout(() => { 171 setTimeout(() => {
173 this.initScroll(); 172 this.initScroll();
174 - setTimeout(() => {  
175 - this.pullDownInitTop = 0 - this.$refs.pulldown.clientHeight;  
176 - }, 0); 173 +
177 }, 20); 174 }, 20);
178 }, 175 },
179 methods: { 176 methods: {
@@ -257,21 +254,28 @@ export default { @@ -257,21 +254,28 @@ export default {
257 } 254 }
258 }, 255 },
259 _initLottie() { 256 _initLottie() {
260 - this.lottieBefore = lottie.loadAnimation({  
261 - container: document.getElementById('beforePullDown'), // the dom element that will contain the animation  
262 - renderer: 'svg',  
263 - loop: false,  
264 - autoplay: true,  
265 - path: 'https://cdn.yoho.cn/mapp/lottie/ufo-pull-1227.json' // the path to the animation json  
266 - });  
267 - this.lottieAfter = lottie.loadAnimation({  
268 - container: document.getElementById('afterPullDown'), // the dom element that will contain the animation  
269 - renderer: 'svg',  
270 - loop: true,  
271 - autoplay: true,  
272 - path: 'https://cdn.yoho.cn/mapp/lottie/ufo-refresh-1227.json' // the path to the animation json  
273 - });  
274 - 257 + setTimeout(() => {
  258 + import(/* webpackChunkName: "lottie-web" */ 'lottie-web').then(lottie => {
  259 + this.lottieBefore = lottie.loadAnimation({
  260 + container: document.getElementById('beforePullDown'), // the dom element that will contain the animation
  261 + renderer: 'svg',
  262 + loop: false,
  263 + autoplay: true,
  264 + path: 'https://cdn.yoho.cn/mapp/lottie/ufo-pull-1227.json' // the path to the animation json
  265 + });
  266 + this.lottieAfter = lottie.loadAnimation({
  267 + container: document.getElementById('afterPullDown'), // the dom element that will contain the animation
  268 + renderer: 'svg',
  269 + loop: true,
  270 + autoplay: true,
  271 + path: 'https://cdn.yoho.cn/mapp/lottie/ufo-refresh-1227.json' // the path to the animation json
  272 + });
  273 + this.$nextTick(() => {
  274 + this.pullDownInitTop = 0 - this.$refs.pulldown.clientHeight;
  275 + console.log(this.pullDownInitTop)
  276 + });
  277 + });
  278 + }, 200);
275 }, 279 },
276 _initPullDownRefresh() { 280 _initPullDownRefresh() {
277 this.scroll.on('pullingDown', () => { 281 this.scroll.on('pullingDown', () => {
@@ -280,6 +284,7 @@ export default { @@ -280,6 +284,7 @@ export default {
280 this.$emit('pullingDown'); 284 this.$emit('pullingDown');
281 }); 285 });
282 this.scroll.on('scroll', (pos) => { 286 this.scroll.on('scroll', (pos) => {
  287 + console.log('scroll')
283 if (!this.pullDownRefresh) { 288 if (!this.pullDownRefresh) {
284 return; 289 return;
285 } 290 }
@@ -336,8 +341,11 @@ export default { @@ -336,8 +341,11 @@ export default {
336 341
337 <style lang="scss" scoped> 342 <style lang="scss" scoped>
338 .list-wrapper { 343 .list-wrapper {
339 - position: relative;  
340 - height: 100%; 344 + position: absolute;
  345 + top: 0;
  346 + right: 0;
  347 + left: 0;
  348 + bottom: 0;
341 overflow: hidden; 349 overflow: hidden;
342 background: #fff; 350 background: #fff;
343 351
1 import {subscribe} from 'webpack-hot-middleware/client?dynamicPublicPath=true&path=__webpack_hmr&noInfo=true&reload=true'; 1 import {subscribe} from 'webpack-hot-middleware/client?dynamicPublicPath=true&path=__webpack_hmr&noInfo=true&reload=true';
2 2
3 -subscribe(event => { 3 +subscribe(function(event) {
4 if (event.action === 'reload') { 4 if (event.action === 'reload') {
5 window.location.reload(); 5 window.location.reload();
6 } 6 }
@@ -24,7 +24,8 @@ const webpackConfig = { @@ -24,7 +24,8 @@ const webpackConfig = {
24 resolve: { 24 resolve: {
25 extensions: ['.js', '.vue', '.json'], 25 extensions: ['.js', '.vue', '.json'],
26 alias: { 26 alias: {
27 - vue$: 'vue/dist/vue.runtime.esm.js' 27 + vue$: 'vue/dist/vue.runtime.esm.js',
  28 + 'lottie-web': 'lottie-web/build/player/lottie_light.min.js'
28 }, 29 },
29 modules: [ 30 modules: [
30 path.join(__dirname, '../apps'), 31 path.join(__dirname, '../apps'),
@@ -41,6 +41,12 @@ const webpackConfig = merge(baseConfig, { @@ -41,6 +41,12 @@ const webpackConfig = merge(baseConfig, {
41 chunks: 'all', 41 chunks: 'all',
42 name: 'swiper', 42 name: 'swiper',
43 test: /swiper/, 43 test: /swiper/,
  44 + },
  45 + lottie: {
  46 + priority: 1,
  47 + chunks: 'all',
  48 + name: 'lottie',
  49 + test: /lottie-web/,
44 } 50 }
45 } 51 }
46 } 52 }