idk
This commit is contained in:
Generated
+426
-15421
File diff suppressed because it is too large
Load Diff
+15
-12
@@ -73,15 +73,14 @@
|
||||
:class="['column', `is-${12 / config.columns}`]"
|
||||
/>
|
||||
</template>
|
||||
<template v-for="group in external">
|
||||
<template v-for="group in wsdata">
|
||||
<h2 v-if="group.name" v-bind:key="group.name" class="column is-full group-title">
|
||||
<i v-if="group.icon" :class="group.icon"></i>
|
||||
{{ group.name }}
|
||||
</h2>
|
||||
<External
|
||||
v-for="item in group.items"
|
||||
:key="item.name"
|
||||
v-bind:item="item"
|
||||
v-bind:item="group.data"
|
||||
:key="group.id"
|
||||
:class="['column', `is-${12 / config.columns}`]"
|
||||
/>
|
||||
</template>
|
||||
@@ -182,6 +181,9 @@ export default {
|
||||
showMenu: true,
|
||||
wsconnection: null,
|
||||
wsapi: null,
|
||||
dvbtuner: null,
|
||||
sysstat: null,
|
||||
wsdata:[],
|
||||
};
|
||||
},
|
||||
created: async function () {
|
||||
@@ -192,21 +194,22 @@ export default {
|
||||
this.external = this.config.external;
|
||||
document.title = `${this.config.title} | ${this.config.subtitle}`;
|
||||
// ws section
|
||||
let that = this;
|
||||
this.wsconnection = new WebSocket("wss://sco.snakes.wtf/api");
|
||||
|
||||
this.wsconnection.onmessage = function(event) {
|
||||
console.log(event.data)
|
||||
}
|
||||
this.wsconnection.onopen = function(event) {
|
||||
console.log(event)
|
||||
this.sendMessage("onopen");
|
||||
let tmp = JSON.parse(event.data);
|
||||
that.wsdata[tmp.id] = tmp;
|
||||
console.log("recv(onmessage)",JSON.parse(event.data)) //recv
|
||||
}
|
||||
// this.wsconnection.onopen = function(event) {}
|
||||
//that.sendMessage("helo");
|
||||
// }
|
||||
|
||||
},
|
||||
methods: {
|
||||
sendMessage: function(message) {
|
||||
console.log(this.connection);
|
||||
this.connection.send(message);
|
||||
sendMessage: function(message) {
|
||||
this.wsconnection.send(message);
|
||||
},
|
||||
getConfig: function (path = "config.yml") {
|
||||
return fetch(path).then((response) => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<div v-for="diocane in response" :key="diocane.id" class="card">
|
||||
<div v-for="diocane in item" :key="diocane.id" class="card">
|
||||
<a href="#" :target="item.target" rel="noreferrer">
|
||||
<div class="card-content">
|
||||
<div class="media">
|
||||
@@ -34,8 +34,8 @@ export default {
|
||||
};
|
||||
},
|
||||
mounted: function () {
|
||||
this.fetchList();
|
||||
this.timer = setInterval(this.fetchList, 10000);
|
||||
// this.fetchList();
|
||||
// this.timer = setInterval(this.fetchList, 10000);
|
||||
},
|
||||
methods: {
|
||||
fetchList: async function () {
|
||||
@@ -52,13 +52,13 @@ export default {
|
||||
//console.error(this.response.stderr);
|
||||
}
|
||||
},
|
||||
cancelAutoUpdate: function () {
|
||||
clearInterval(this.timer);
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.cancelAutoUpdate();
|
||||
// cancelAutoUpdate: function () {
|
||||
// clearInterval(this.timer);
|
||||
// }
|
||||
},
|
||||
// beforeDestroy() {
|
||||
// this.cancelAutoUpdate();
|
||||
// },
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user