//在url插入參數
// let path = this.$router.history.current.path;
// //對象的拷貝
// let newQuery = {};
// newQuery.pid = "123456";
// this.$router.push({ path, query: newQuery });
created() {
console.log("路徑:", this.$route);
this.getInsertAccessLog();
// console.log('queryOnlyUuid:',this.queryOnlyUuid)
if (window.history && window.history.pushState) {
// 往歷史記錄裏面添加一條新的當前頁面的url
history.pushState(null, null, document.URL);
// 給 popstate 綁定一個方法 監聽頁面刷新
window.addEventListener('popstate', this.backChange, false);//false阻止默認事件
}
}
destroyed(){
window.removeEventListener('popstate', this.backChange, false);//false阻止默認事件
},
methods: {
backChange() {
const that = this;
console.log("監聽到了");
this.$router.push({name: 'home', query: {onlyUuid: this.queryOnlyUuid}})
}
}