商城分析

入口程序分析main.js  

require('es6-promise').polyfill()       
import Vue from 'vue'
import App from './App'
import router from './router'
import 'babel-polyfill'
import '@/plugins/flexible'
import MintUI from 'mint-ui'
import store from '@/store'
import FastClick from 'fastclick'
import '@/utils/directives'
import '@/utils/filters'
import VeeValidate from 'vee-validate';
if ('addEventListener' in document) {
    document.addEventListener('DOMContentLoaded', function() {
        FastClick.attach(document.body);
    }, false);
}

Vue.use(MintUI)
Vue.use(VeeValidate);
router.beforeEach((to,from,next)=>{
    next();
});
Vue.config.productionTip = false;

/* fundebug */
function formatComponentName(vm)
{
  if (vm.$root === vm) return 'root';

  const name = vm._isVue ? (vm.$options && vm.$options.name) || (vm.$options && vm.$options._componentTag) : vm.name;
  return (name ? 'component <' + name + '>' : 'anonymous component') + (vm._isVue && vm.$options && vm.$options.__file ? ' at ' + (vm.$options && vm.$options.__file) : '');
}

Vue.config.errorHandler = function(err, vm, info)
{
  const componentName = formatComponentName(vm);
  const propsData = vm.$options && vm.$options.propsData;

  fundebug.notifyError(err,
  {
      metaData:
      {
          componentName: componentName,
          propsData: propsData,
          info: info
      }
   });
};


/* eslint-disable no-new */
Vue.prototype.errorEvent = e => { e.target.src = './assets/images/logo.png' };
new Vue({
  el: '#app',
  store,
  router,
  template: '<App/>',
  components: { App }
});

首先是Babel转码器支持,因为使用了很多ES6语法,为了使代码在各类浏览器运行时没有问题,需要引入Babel。

其次引入Mint-UI组件库,引入表单以及域校验组件VeeValidate,还有避免点击延时的 fastclick组件,以及登陆不同终端适配的fexible.js

HTTP请求封装:

1、科普 Promise,解决Node服务端的 有序异步调用,参见这里 通过链式调用解决了生产线上工序间的前后依赖问题。

2、Axios 和Promise结合完美解决,Node的服务器请求问题。(Axios中文)

utils:依赖axios,es6-promise, main.js依赖mint-ui, vee-validate, fastclick

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值