vue-fetch 兼容性基本使用

本文介绍了在Vue项目中使用fetch进行数据请求时,如何处理IE浏览器的兼容性问题。通过安装isomorphic-fetch, es6-promise和promise-polyfill库,并在index.js中引入promise-polyfill,确保在IE环境下fetch API的正常工作。" 111342785,10293315,国产PGL12G FPGA开发:黑金与紫光同创环境搭建与Verilog实战,"['FPGA开发', '国产芯片', '硬件设计', 'Verilog编程']
摘要由CSDN通过智能技术生成

安装命令“

cnpm install –save isomorphic-fetch es6-promise

由于ie不支持Promise,所以需要安装promise-polyfill;

cnpm install promise-polyfill –save-exact

需要在index.js中引用

import Vue from 'vue'
import Router from 'vue-router'
import Promise from "promise-polyfill";

if(!window.Promise){
    window.Promise = Promise;
}

使用

<template>
  <div class="hello">
    <h1 @click="getUrl">{
  { msg }}</h1>
    <router-link to="/test/one">testlinks</router-link>
    <router-link to="/test/two" exact>testlinks1</router-link>
    <
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值