Commit 4f8a7cf8 authored by “yiyousong”'s avatar “yiyousong”

perf: 优化站点详情页面的设备icon显示

parent baf08304
...@@ -147,7 +147,7 @@ ...@@ -147,7 +147,7 @@
justify="space-between" justify="space-between"
> >
<img <img
v-if="formatDevIcon(v.productId)" v-if="formatDevIcon(v.productId) && isImageAvailable(v.productId)"
:src="require(`@/assets/images/${formatDevIcon(v.productId)}.png`)" :src="require(`@/assets/images/${formatDevIcon(v.productId)}.png`)"
/> />
<img v-else src="@/assets/images/dn.png" /> <img v-else src="@/assets/images/dn.png" />
...@@ -221,10 +221,10 @@ export default { ...@@ -221,10 +221,10 @@ export default {
this.query = Object.assign({}, this.query, { deviceName: val }); this.query = Object.assign({}, this.query, { deviceName: val });
this.getData(); this.getData();
}, },
editSite(){ editSite() {
this.$confirm('请在基础设置系统修改站点信息','提示',{ this.$confirm("请在基础设置系统修改站点信息", "提示", {
showCancelButton: false, //是否显示取消按钮 showCancelButton: false, //是否显示取消按钮
}) });
}, },
addDevice() { addDevice() {
let row = {}; let row = {};
...@@ -302,6 +302,14 @@ export default { ...@@ -302,6 +302,14 @@ export default {
let label = productId[product]; let label = productId[product];
return label || ""; return label || "";
}, },
isImageAvailable(product) {
try {
require(`@/assets/images/${this.formatDevIcon(product)}.png`);
return true;
} catch (error) {
return false;
}
},
}, },
data() { data() {
return { return {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment