1、安装 cnpm install axios -S

2、引用 main.js

import axios from 'axios';

Vue.prototype.$axios = axios

3/使用

me.$axios

        .get(me.baseURL + "verify/imgs"

        //, {

        //  responseType: "arraybuffer"//仅在返回二进制流byte使用

        //}

        )

        .then(response => {

          return (

            "data:image/png;base64," +

            btoa(

              new Uint8Array(response.data).reduce(

                (data, byte) => data + String.fromCharCode(byte),

                ""

              )

            )

          );

        })

        .then(response => {

          me.verimgPath=response;

        });

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐