problem description
for example, if the background management system modifies the data, how can the front-end page retrieve the data in time?
the environmental background of the problems and what methods you have tried
set,watch,computed that has used vue also failed to solve
related codes
/ / Please paste the code text below (do not replace the code with pictures)
< template >
<div id="app">
{{id}}
<router-view/>
</div>
< / template >
< script >
export default {
name: "App",
data() {
return {
id: "images_show"
}
},
methods: {
getRouterLink () {
this.$axios.get("http://192.168.0.182:8084/Temp/temp1").then(
res => {
console.log(res.data,);
this.id = res.data;
if (this.id === "images_show") {
this.$router.push("/")
} else if (this.id === "change_video") {
this.$router.push("/media")
} else if (this.id === "change_luck") {
this.$router.push("/random")
} else if (this.id === "change_photoes") {
this.$router.push("/voice")
}else if (this.id === "change_voice") {
this.$router.push("/admin")
}
}
).catch(
err => {
console.log(err);
}
);
}
},
created() {
this.getRouterLink()
}
}
what result do you expect? What is the error message actually seen?
I hope God can answer, or give another idea; it is best to be able to re-request the interface if the data in the database has changed without refreshing the page.