Fixed single proxy display error

This commit is contained in:
Peng-YM 2020-09-23 18:00:04 +08:00
parent 3d208c9e9f
commit d30ece21ae
6 changed files with 73 additions and 9 deletions

View File

@ -45,7 +45,7 @@ function initStore(store) {
export default {
components: {
TopToolbar,
BottomNav
BottomNav,
},
created() {

View File

@ -68,6 +68,14 @@
>
<v-card-title>
{{ info.name }}
<v-spacer></v-spacer>
<v-btn
icon
color="white"
@click="copyLink()"
>
<v-icon>content_copy</v-icon>
</v-btn>
</v-card-title>
<v-card-text
align="center"
@ -103,7 +111,8 @@ export default {
region: "",
ip: ""
},
qr: ""
qr: "",
link: ""
}
},
methods: {
@ -115,8 +124,8 @@ export default {
async fetch() {
await axios.get(this.url).then(resp => {
const {data} = resp;
if (data.indexOf("\n") !== -1)
let {data} = resp;
if (data instanceof String && data.indexOf("\n") !== -1)
this.proxies = data.split("\n").map(p => JSON.parse(p));
else
this.proxies = [data];
@ -126,7 +135,7 @@ export default {
await axios.get(`${this.url}?target=URI`).then(resp => {
const {data} = resp;
if (data.indexOf("\n") !== -1)
if (data instanceof String && data.indexOf("\n") !== -1)
this.uris = data.split("\n");
else
this.uris = [data];
@ -150,8 +159,14 @@ export default {
this.dialog = true
},
async showQRCode(idx) {
copyLink() {
this.$clipboard(this.link);
this.$store.commit("SET_SUCCESS_MESSAGE", `节点链接已复制到剪贴板!`);
},
showQRCode(idx) {
this.qr = this.uris[idx];
this.link = this.uris[idx];
this.info.name = this.proxies[idx].name;
this.showQR = true;
}

View File

@ -0,0 +1,48 @@
<template>
<v-fab-transition>
<v-speed-dial
v-model="opened"
direction="top"
left
fab
absolute
bottom
small
transition="slide-y-reverse-transition"
>
<template #activator>
<v-btn
fab
>
<v-icon v-if="opened">mdi-close</v-icon>
<v-icon v-else>apps</v-icon>
</v-btn>
</template>
<v-btn
fab
color="primary"
>
<v-icon>mdi-plus</v-icon>
</v-btn>
<v-btn
fab
color="primary"
>
<v-icon>create_new_folder</v-icon>
</v-btn>
</v-speed-dial>
</v-fab-transition>
</template>
<script>
export default {
data() {
return {
opened: false,
}
},
computed: {
}
}
</script>

View File

@ -48,7 +48,6 @@ const router = new Router({
router.beforeEach((to, from, next) => {
const {meta} = to;
// document.title = to.meta.title
store.commit("SET_NAV_TITLE", meta.title);
next();
})

View File

@ -1,4 +1,5 @@
import Axios from 'axios';
import Vue from 'vue';
import store from "@/store";
import {BACKEND_BASE} from "@/config";
@ -7,6 +8,8 @@ export const axios = Axios.create({
timeout: 10000
});
export const EventBus = new Vue();
export function isEmptyObj(obj) {
return Object.keys(obj).length === 0;
}

View File

@ -98,11 +98,10 @@
v-if="!showProxyList"
v-model="opened"
direction="top"
right
left
fab
absolute
bottom
small
transition="slide-y-reverse-transition"
>
<template #activator>