需要先转换为base64编码返回
File imageFile = new File(one.getValuess().toString());
//通过ImageIO把文件读取成BufferedImage对象
BufferedImage bufferedImage = null;
try {
bufferedImage = ImageIO.read(imageFile);
} catch (IOException e) {
throw new RuntimeException(e);
}
//构建字节数组输出流
ByteArrayOutputStream baos = new ByteArrayOutputStream();
//写入流
String suffix =imageFile.getName().substring(imageFile.getName().lastIndexOf(".") + 1);
try {
ImageIO.write(bufferedImage, suffix, baos);
} catch (IOException e) {
throw new RuntimeException(e);
}
//通过字节数组流获取字节数组
byte[] byte1s = baos.toByteArray();
//获取JDK8里的编码器Base64.Encoder转为base64字符
String s1 = Base64.getEncoder().encodeToString(byte1s);
<img style="width: 200px; height: 80px;" :src="'data:image;base64,'+record.text[0]">