refactor(接口测试): 优化接口列表标签样式

This commit is contained in:
wxg0103 2022-06-08 16:32:00 +08:00 committed by 刘瑞斌
parent 791a2418bd
commit fee36168e5
2 changed files with 29 additions and 5 deletions

View File

@ -134,13 +134,20 @@
min-width="180px"
:field="item"
:fields-width="fieldsWidth"
:show-overflow-tooltip=false
:label="'API'+ $t('api_test.definition.api_path')"/>
<ms-table-column v-if="item.id=='tags'" prop="tags" width="120px" :label="$t('commons.tag')">
<ms-table-column v-if="item.id=='tags'" prop="tags" width="120px" :label="$t('commons.tag')"
:show-overflow-tooltip=false>
<template v-slot:default="scope">
<ms-tag v-for="(itemName,index) in scope.row.tags" :key="index" type="success" effect="plain"
:show-tooltip="scope.row.tags.length===1&&itemName.length*12<=120"
:content="itemName" style="margin-left: 0px; margin-right: 2px"/>
<el-tooltip class="item" effect="dark" placement="top">
<div v-html="getTagToolTips(scope.row.tags)" slot="content"></div>
<div class="oneLine">
<ms-tag v-for="(itemName,index) in scope.row.tags" :key="index" type="success" effect="plain"
:show-tooltip="scope.row.tags.length===1&&itemName.length*12<=100" :content="itemName"
style="margin-left: 0px; margin-right: 2px"/>
</div>
</el-tooltip>
<span/>
</template>
</ms-table-column>
@ -1255,6 +1262,17 @@ export default {
}
});
}
},
getTagToolTips(tags) {
try {
let showTips = "";
tags.forEach(item => {
showTips += item + ",";
})
return showTips.substr(0, showTips.length - 1);
} catch (e) {
return "";
}
}
},
};
@ -1306,6 +1324,12 @@ export default {
color: #6D317C;
}
.oneLine {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.ms-unexecute {
}
</style>

View File

@ -956,7 +956,7 @@ export default {
tags.forEach( item => {
showTips += item + ",";
})
return showTips;
return showTips.substr(0, showTips.length - 1);
}catch (e){
return "";
}