安装
npm install iconv-lite --save
main.js
var iconv = require('iconv-lite'); app.config.globalProperties.iconv = iconv
hexToString('b2d9d7f7b3c9b9a60000000000') function hexToString(h) { // let gbk_buf = proxy.iconv.encode(t, 'gbk'); //gbk编码 // console.log(gbk_buf, 'gbk_buf++++++') let gbk_buf = Buffer.from(h, 'hex'); //gbk编码 console.log(gbk_buf, 'gbk_buf++++++') let gbk_str = proxy.iconv.decode(gbk_buf, 'gbk'); //gbk解码 console.log(gbk_str, 'gbk_str++++++') }