界面优化
This commit is contained in:
@@ -206,7 +206,7 @@
|
||||
<td colspan="5" v-if="!site.nasname" style="color:#339933;font-weight:bold;text-align:center;">{{site.city}}</td>
|
||||
<td v-if="site.nasname">{{site.city}}</td>
|
||||
<td v-if="site.nasname">{{site.supply}}</td>
|
||||
<td v-if="site.nasname">{{site.nasname}}</td>
|
||||
<td v-if="site.nasname">{{site.nasname}} <a style="cursor:pointer;" v-on:click="copyText(site.nasname)">复制</a></td>
|
||||
<td v-if="site.nasname">{{site.online}}</td>
|
||||
<td v-if="site.nasname"><button type="button" v-on:click="detail(site)" class="btnDetail">详情</button></td>
|
||||
</tr>
|
||||
@@ -291,6 +291,31 @@
|
||||
this.select_product(0);
|
||||
},
|
||||
methods: {
|
||||
copyText(text) {
|
||||
// 检查浏览器是否支持 Clipboard API
|
||||
if (!navigator.clipboard) {
|
||||
// 如果不支持,则使用传统的 document.execCommand("copy") 方式
|
||||
const textArea = document.createElement("textarea");
|
||||
textArea.value = text;
|
||||
textArea.style.position = "fixed";
|
||||
document.body.appendChild(textArea);
|
||||
textArea.focus();
|
||||
textArea.select();
|
||||
document.execCommand("copy");
|
||||
document.body.removeChild(textArea);
|
||||
return;
|
||||
}
|
||||
|
||||
// 使用 Clipboard API 复制内容到剪切板
|
||||
navigator.clipboard.writeText(text).then(
|
||||
function() {
|
||||
console.log("复制成功");
|
||||
},
|
||||
function() {
|
||||
console.log("复制失败");
|
||||
}
|
||||
);
|
||||
},
|
||||
select_product(ProductId){
|
||||
this.product_id = ProductId;
|
||||
let datalist = [];
|
||||
|
||||
Reference in New Issue
Block a user