1.0.1-beta • Published 2 years ago

@peter.fe/core v1.0.1-beta

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

@peter.fe/core 核心包介绍

阐述

导出了常用的开源库和创建了 Vue 的实例

  • vue
  • vue-router
  • axios
  • dayjs
  • element-ui
  • lodash
  • install
import Vue, {
  VueRouter,
  axios,
  dayjs,
  ElementUI,
  _ as lodash,
  install,
} from "@peter.fe/core";

install 使用说明

import Vue, { install } from "@peter.fe/core";
Vue.use(install, {
  netWork: {
    // 网络库,参照@peter.fe/network参数说明
    responseCallBack: (res) => {
      console.log(res);
    },
    requestCallBack: (config) => {
      return config;
    },
    dataFormatCallback: (res) => {
      return res.data;
    },
    headers: { "content-type": "json" },
    baseURL: "https://wwww.baidu.com",
    successCode: 200,
    timeout: 5000,
  },
  Router: {
    routes: [],
    mode: "hash",
    beforeEach: (to, from, next, http) => {
      console.log(to, from, http);
      next();
    },
    beforeResolve: (to, from, next, http) => {
      console.log(to, from, http);
      next();
    },
  },
});

install options 参数说明

参数说明类型可选值默认值是否必传
osPlugin自定义插件Object--false
Router路由相关参数,见下表Object--false
netWork见@peter.fe/network 包说明文档的构造参数Object--false

Router 参数说明

参数说明类型可选值默认值是否必传
routes路由表Array-[]true
beforeEach路由前置拦截函数Function--false
beforeResolve路由全局解析守卫Function--false
1.0.1-beta

2 years ago

1.0.0

2 years ago