|
|
const Vue = require('vue');
|
|
|
const $ = require('jquery');
|
|
|
const app = require('product/detail/index.vue');
|
|
|
const loading = require('common/loading');
|
|
|
const lazyload = require('vue-lazyload');
|
|
|
const directive = require('common/vue-directive');
|
|
|
const app = require('product/detail/index.vue');
|
|
|
|
|
|
require('common/vue-filter');
|
|
|
require('common/overlay');
|
|
|
|
|
|
Vue.use(lazyload);
|
|
|
|
|
|
(() => {
|
|
|
let stop = 0;
|
|
|
|
|
|
$(document).ajaxStart(()=> {
|
|
|
// start = new Date().getTime();
|
|
|
|
|
|
// setTimeout(()=> {
|
|
|
if (stop === 0) { // 超过100ms请求仍未结束则显示
|
|
|
loading.show();
|
|
|
}
|
|
|
|
|
|
// }, 100);
|
|
|
});
|
|
|
|
|
|
$(document).ajaxStop(()=> {
|
|
|
stop = new Date().getTime();
|
|
|
loading.hide();
|
|
|
});
|
|
|
})();
|
|
|
|
|
|
Vue.directive('lazy-html', function(html) {
|
|
|
html = html.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/gi, '<img v-lazy="\'$1\'">');
|
|
|
this.el.innerHTML = html;
|
|
|
this.vm.$compile(this.el);
|
|
|
});
|
|
|
Vue.use(directive);
|
|
|
|
|
|
new Vue({
|
|
|
el: '#app',
|
...
|
...
|
|