Go to file
2022-06-15 17:14:27 +08:00
build fix: 解决打包后无法发送请求的bug 2022-05-28 00:32:32 +08:00
plop fix: 修改plop的问题 2022-05-20 16:12:09 +08:00
public docs: 修改文档路径 2022-05-06 20:23:08 +08:00
readme docs: 修改文档路径 2022-05-06 20:23:08 +08:00
src feat: 新增渐变文本组件 2022-06-15 16:20:25 +08:00
types type: 定义全局返回值类型 2022-06-01 22:41:11 +08:00
.env build: 修改请求地址 2022-05-31 11:19:17 +08:00
.eslintignore fix:路由处理,CSS处理,样式处理,全局变量处理 2021-12-14 15:53:30 +08:00
.eslintrc.js fix:路由处理,CSS处理,样式处理,全局变量处理 2021-12-14 15:53:30 +08:00
.gitignore init 2021-12-10 14:11:49 +08:00
index.css fix:修改移动端提示文案字体 2022-03-12 11:46:39 +08:00
index.html feat: 新增页面预览方式 2022-05-04 01:46:56 +08:00
LICENSE init 2021-12-10 14:11:49 +08:00
Makefile fix: 修改 Makefile 文件 2022-04-13 11:18:51 +08:00
package.json fix: 解决npm,yarn 安装依赖报错的问题 2022-06-15 16:08:59 +08:00
pnpm-lock.yaml build:升级依赖 2022-06-15 16:11:58 +08:00
prettier.config.js fix:路由处理,CSS处理,样式处理,全局变量处理 2021-12-14 15:53:30 +08:00
README.md doc: 文档更新 2022-06-15 17:14:27 +08:00
tsconfig.json fix: 修改图片引入打包报错的问题 2022-02-28 20:26:04 +08:00
vite.config.ts feat: 新增登录接口请求 2022-05-20 16:12:27 +08:00

总览

logo

master-fetch 分支是带有后端接口请求的分支

后端项目地址:https://gitee.com/MTrun/go-view-serve

接口说明地址:https://docs.apipost.cn/preview/5aa85d10a59d66ce/ddb813732007ad2b?target_id=84dbc5b0-158f-4bcb-8f74-793ac604ada3#3e053622-1e76-43f9-a039-756aee822dbb

使用

所有的接口地址位置:src\api\path\*

接口地址修改:.env

# port
VITE_DEV_PORT = '8080'

# development path
VITE_DEV_PATH = 'http://127.0.0.1:8080'

# production path
VITE_PRO_PATH = 'http://127.0.0.1:8080'

公共前缀修改:src\settings\httpSetting.ts

// 请求前缀
export const axiosPre = '/goview'

接口封装:src\api\http.ts

import axiosInstance from './axios'
import { RequestHttpEnum, ContentTypeEnum } from '@/enums/httpEnum'

export const get = (url: string, params?: object) => {
  return axiosInstance({
    url: url,
    method: RequestHttpEnum.GET,
    params: params,
  })
}

export const post = (url: string, data?: object, headersType?: string) => {
  return axiosInstance({
    url: url,
    method: RequestHttpEnum.POST,
    data: data,
    headers: {
      'Content-Type': headersType || ContentTypeEnum.JSON
    }
  })
}

export const put = (url: string, data?: object, headersType?: string) => {
  return axiosInstance({
    url: url,
    method: RequestHttpEnum.PUT,
    data: data,
    headers: {
      'Content-Type': headersType || ContentTypeEnum.JSON
    }
  })
}

export const del = (url: string, params?: object) => {
  return axiosInstance({
    url: url,
    method: RequestHttpEnum.DELETE,
    params
  })
}

// 获取请求函数默认get
export const http = (type?: RequestHttpEnum) => {
  switch (type) {
    case RequestHttpEnum.GET:
      return get

    case RequestHttpEnum.POST:
      return post

    case RequestHttpEnum.PUT:
      return put

    case RequestHttpEnum.DELETE:
      return del

    default:
      return get
  }
}

代码提交

  • feat: 新功能
  • fix: 修复 Bug
  • docs: 文档修改
  • perf: 性能优化
  • revert: 版本回退
  • ci: CICD集成相关
  • test: 添加测试代码
  • refactor: 代码重构
  • build: 影响项目构建或依赖修改
  • style: 不影响程序逻辑的代码修改
  • chore: 不属于以上类型的其他类型(日常事务)

交流

QQ 群1030129384

QQ群

渲染海报