vue中使用axios,引入:
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script><script>
Vue.prototype.$axios = axios;
axios.defaults.baseURL = 'http://127.0.0.1:5002/';
this.$axios
.get("/Api/Admin/XHS/GetNeedUpdateData", {
params: {},
})
.then((res) => {
console.log("res.data.resultCode = " + res.data.resultCode);
if (res.data.resultCode != 0) {
console.log(res.data);
}
}).catch((error) => {
//报错
console.log(error);
});
</script>vue中使用定时器:
startTimer() {
this.timer = setInterval(() => {
this.Refresh()
}, 1000);
},
beforeDestroy() {
this.stopTimer(); // 在组件销毁前停止计时器
},
stopTimer() {
clearInterval(this.timer);
}绑定一些特殊地方地方可以用v-bind,缩写:号,比如:
<progress :value="jindu" max="100"></progress>