
我有高级封装
神奇大叔
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
边界错误组件
核心:在componentDidCatch中获取错误信息,根据有无错误信息进行展示 import React from 'react'; import SFCErrorInfo from './SFCErrorInfo'; // own props export interface IErrorBoundaryProps { children?: React.ReactNode; ErrorPresenter?: React.ComponentClass<IErrorBoundarySt原创 2021-08-31 15:44:34 · 131 阅读 · 0 评论 -
上下抖动三点加载
import React from 'react'; import './Loading.less'; export interface ILoadingProps {} type Props = ILoadingProps; export function Loading(props: Readonly<Props>) { return ( <div className="k-common-loading"> <div className="wr.原创 2021-08-30 14:22:52 · 353 阅读 · 0 评论 -
可点击附件(文件)封装
主要特色: 将文件展示放在a标签里,在onClick中通过window.open打开对应链接而非href,是因为可以还可以设置打开页面的标题等设置 import { Flex } from 'antd-mobile'; import React, { Fragment } from 'react'; import IconFont from '../../IconFont'; import './File.less'; export interface FileInfo { name: strin原创 2021-08-25 17:53:16 · 131 阅读 · 0 评论 -
fetch 封装
import qs from 'qs' function ajax(url,params,type='GET') { // let url='http://127.0.0.1:3000'+url; if(type=='GET') { console.log(2); let str=''; Object.keys(params).forEach((item,index)=>{原创 2020-09-04 16:46:11 · 264 阅读 · 0 评论 -
封装fetch(get和post)
import qs from "querystring" export function getData(url) { const result = fetch(url); return result; } export function postData(url,data) { const result = fetch(url, { method: "post", headers: { 'Accept': 'applica原创 2020-07-10 20:31:27 · 544 阅读 · 0 评论 -
封装axios(get和post请求)
/** ajax模块,返回值为promise对象 */ import axios from 'axios' import qs from 'qs' export default function ajax(url,data={},type='GET') { if(type==='GET') { let str='' //将对象拼成url参数对 Object.keys(data).forEach(function(item,ind原创 2020-06-10 15:54:23 · 706 阅读 · 0 评论