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

This commit is contained in:
wxg0103 2022-06-08 16:32:00 +08:00 committed by f2c-ci-robot[bot]
parent d65ba6a9cd
commit 438e7ae94b
2 changed files with 29 additions and 5 deletions

View File

@ -136,13 +136,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>
@ -1264,6 +1271,17 @@ export default {
}
});
}
},
getTagToolTips(tags) {
try {
let showTips = "";
tags.forEach(item => {
showTips += item + ",";
})
return showTips.substr(0, showTips.length - 1);
} catch (e) {
return "";
}
}
},
};
@ -1315,6 +1333,12 @@ export default {
color: #6D317C;
}
.oneLine {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.ms-unexecute {
}
</style>

View File

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