启用订阅缓存,大幅减少浏览器响应延迟

This commit is contained in:
Peng-YM
2020-09-01 12:08:14 +08:00
parent f6f4467c07
commit 3d101cf22a
4 changed files with 94 additions and 80 deletions

View File

@@ -32,11 +32,34 @@
</template>
<script>
import {axios} from "@/utils";
export default {
name: "ProxyList",
props: ['proxies'],
props: ['url'],
data: function (){
return {
proxies: []
}
},
methods: {
refresh() {
axios.post(`/refresh`, {url: this.url}).then(() => {
this.fetch();
})
},
fetch() {
axios.get(this.url).then(resp => {
const {data} = resp;
this.proxies = data.split("\n").map(p => JSON.parse(p));
}).catch(err => {
this.$store.commit("SET_ERROR_MESSAGE", err);
});
}
},
created() {
this.fetch();
}
}
</script>