通过axios获取txt内容(不会产生中文乱码)

let url = 'http://********************************'
            axios({
            method: 'get',
            url,
            responseType: 'blob',
            transformResponse: [function (data) {
            let reader = new FileReader();
            reader.readAsText(data, 'GBK');
                reader.onload = function () {
                //此处便是返回值
                    console.log(reader.result);
                }
                return data;
            }]
            }).then(res => {
            console.log(res.data)
            })

友人A
81 声望11 粉丝