Commit 09d000c0 by liuyong

修改bug

1 parent cdfcb42c
Showing with 20 additions and 26 deletions
......@@ -53,9 +53,7 @@
<el-table-column prop="content" label="描述" align="center" width="200" :show-overflow-tooltip="true"></el-table-column>
<el-table-column label="图标" align="center">
<template slot-scope="scope">
<!-- <img :src="scope.row.icon" alt="" :style="{ 'width': scope.row.width, 'height': scope.row.height }"> -->
<img :src="scope.row.icon" alt="">
<img :src="scope.row.icon" alt="" :style="{ 'width': scope.row.width, 'height': scope.row.height }">
</template>
</el-table-column>
<el-table-column prop="version" label="版本" align="center"></el-table-column>
......@@ -981,7 +979,6 @@ export default {
this.pager.total = result.data.total;
this.pager.size = result.data.size;
if(result.data.records.length > 0) {
result.data.records.length = 1;
result.data.records.map(item => {
if(item.icon.includes("svg+xml")) {
......@@ -989,33 +986,30 @@ export default {
const decode_item_icon = window.atob(item_icon);//svg解码,为字符串
const svgDocument = new DOMParser().parseFromString(decode_item_icon, 'text/xml');//svg字符串转标签
// console.log(svgDocument)
// const path = svgDocument.getElementsByTagName('path')[0];
// const rect = svgDocument.getElementsByTagName('rect')[0];
// const ellipse = svgDocument.getElementsByTagName('ellipse')[0];
// const svgTag = svgDocument.getElementsByTagName('svg')[0];
// const svgWidth = Number(svgTag.getAttribute('width').split('px')[0])/2;
// const svgHeight = Number(svgTag.getAttribute('height').split('px')[0])/2;
// item['width'] = svgWidth + 'px';
// item['height'] = svgHeight + 'px';
const path = svgDocument.getElementsByTagName('path')[0];
const rect = svgDocument.getElementsByTagName('rect')[0];
const ellipse = svgDocument.getElementsByTagName('ellipse')[0];
const svgTag = svgDocument.getElementsByTagName('svg')[0];
const svgWidth = Number(svgTag.getAttribute('width').split('px')[0])/2;
const svgHeight = Number(svgTag.getAttribute('height').split('px')[0])/2;
item['width'] = svgWidth + 'px';
item['height'] = svgHeight + 'px';
// if(path) {
// path.setAttribute('fill', item.color);
// }
// if(rect) {
// rect.setAttribute('fill', item.color);
// }
// if(ellipse) {
// ellipse.setAttribute('fill', item.color);
// }
if(path) {
path.setAttribute('fill', item.color);
}
if(rect) {
rect.setAttribute('fill', item.color);
}
if(ellipse) {
ellipse.setAttribute('fill', item.color);
}
const svgToString = new XMLSerializer().serializeToString(svgDocument);//svg标签转化为字符串
const encode_item_icon = window.btoa(svgToString);//base64编码
item.icon = 'data:image/svg+xml;base64,'+ encode_item_icon;
}else {
const encode_item_icon = window.btoa(item.icon);//base64编码
item.icon = 'data:image/svg+xml;base64,'+ encode_item_icon;
console.log(item)
// item['width'] = 0;
// item['height'] = 0;
item['width'] = 0;
item['height'] = 0;
}
})
Promise.all([ this.get_dialog_select1(), this.get_dialog_select2() ]).then(res2 => {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!