zoukankan      html  css  js  c++  java
  • 梦学谷会员管理系统

    一。项目环境搭建

    1.安装node.js

    2.全局安装vue和vue-cli
    3.创建项目
    vue create初始化项目
    4.npm run serve
    以服务端运行vue-cli模板
    5.配置vue.config.js文件
     1 module.exports = {
     2     devServer: {
     3         port:8080,
     4         host:"localhost",
     5         https:false,
     6         open:true
     7     },
     8     lintOnSave:false,
     9     productionSourceMap:false
    10 }

    6.整合第三方库

    npm i -S axios

    npm i -S pubsub-js

    7.安装element-ui

    npm i -S element-ui

    在main.js中引入elementUI插件

    Vue.use(elementUI)使用插件

    安装element UI snippets插件用来提示elementUI语法提示

    8.自定义封装axios

    通过 Axios 发送异步请求,所以封装一个 Axios 对象。自已封装的 Axios 在后续可以使用
    axios 中提供的拦截器。

    src 目录下创建 utils 目录及 utils 下面创建 request.js 文件

    1 import axios from "axios"
    2 const request=axios.create({
    3     baseURL:"/",
    4     timeout:5000
    5 })
    6 export default request

    自定义请求拦截器和响应拦截器

     1 // 请求拦截器
     2 request.interceptors.requset.use(config=>{
     3 // 请求拦截
     4 return config
     5 },error=>{
     6 // 出现异常
     7 return Promise.reject(error)
     8 })
     9 // 响应拦截器
    10 request.interceptors.response.use(response=>{
    11     return response
    12     },error=>{
    13     return Promise.reject(error)
    14     })
    15 request.get("'./db.json").then(response=>{
    16     console.log(response.data)
    17 })

  • 相关阅读:
    1058 A+B in Hogwarts (20)
    1036. Boys vs Girls (25)
    1035 Password (20)
    1027 Colors in Mars (20)
    1009. Product of Polynomials (25)
    1006. Sign In and Sign Out
    1005 Spell It Right (20)
    1046 Shortest Distance (20)
    ViewPager页面滑动,滑动到最后一页,再往后滑动则执行一个事件
    IIS7.0上传文件限制的解决方法
  • 原文地址:https://www.cnblogs.com/donutkiki/p/11587818.html
Copyright © 2011-2022 走看看