1.html刷新界面
<meta http-equiv="refresh" content="3">
意思是隔3秒钟后刷新.(每隔3秒刷新一次)
上面没有写网页地址(URL),格式应当是:
<meta http-equiv="Refresh" content="n;url">
n -- 隔n秒钟
url -- 转此地址
2. vue只刷新一次
mounted: function() {
if (location.href.indexOf("#reloaded") == -1) {
location.href = location.href + "#reloaded";
location.reload();
}
},
3.$nextTick
<div :key='key'>
内容
</div>
data中
key:0
哪里需要往哪里搬
this.$nextTick(() => { this.key++ })
4.location.reload
<div>
<button @click="refresh">点击刷新页面</button>
<div>
methods: {
refresh() {
location.reload();
},
},