vue3图片报错转换为空白不显示的方法
直接上代码:
<el-table-column label="领料人" align="center"><template #default="scope"><el-imagev-if="scope.row.receiver":src="scope.row.receiver"style="width: 100px; height: 100px"@error="handlerErrorImg(scope.row)"/></template></el-table-column>
function handlerErrorImg(row) {console.log("error", row);row.maker = "";row.maker = null;row.receiver = null;// 设置为空row.reactive = "";
}
这样即使页面报错,也不是报错的样式,而是空白,页面更加美观