加入毫秒显示

This commit is contained in:
lingling 2023-04-01 15:48:02 +08:00
parent 839629eb4a
commit 902492defc
1 changed files with 17 additions and 2 deletions

View File

@ -4,8 +4,10 @@
<h6 style="text-align: center;margin: 1rem;">{{ props.serve.tips }} <q-icon v-show="online" title="在线"
name="check_circle_outline" style="color: green;" /> <q-icon v-show="!online" title="离线" name="highlight_off"
style="color: red;" /></h6>
<div v-show="online" style="text-align: center;"><q-icon title="在线" name="signal_cellular_alt"
:style="{ color: signal_style }" /><span>{{ time }}ms</span></div>
<q-input v-model="outtext" filled autogrow readonly />
<div style="text-align: center;margin-top: 1rem;display: flex;justify-content: space-around;">
<div style="text-align: center;margin-top: 1rem;">
<q-btn color="white" text-color="black" @click="copy('link')" label="复制" />
<!-- <q-btn color="white" text-color="black" @click="copy('sub')" label="复制订阅" /> -->
</div>
@ -40,10 +42,12 @@ export default defineComponent({
let http = props.serve.istls == 0 ? 'http' : 'https'
api.text_server(`${http}://${props.serve.ip}:${props.serve.port}/${ip}`).then(res => {
online.value = res.data.sataus == 400
time.value = res.data.time
})
}
const api = new getdata;
const $q = useQuasar()
const time = ref(0)
const outtext = computed(() => {
let tmp = ''
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@ -69,6 +73,17 @@ export default defineComponent({
return tmp
})
const signal_style = computed(() => {
let tmp = ''
if (time.value >= 0 && time.value <= 700) {
tmp = 'green'
} else if (time.value > 700 && time.value < 1400) {
tmp = '#FF9800'
} else {
tmp = 'red'
}
return tmp
})
const copy = (type: string) => {
let tmp = ''
switch (type) {
@ -98,7 +113,7 @@ export default defineComponent({
})
})
}
return { props, outtext, copy, online };
return { props, outtext, copy, online, time, signal_style };
},
});
</script>