應用於監視路由地址改變,若有新地址(即路由地址改變)即執行自定義方法ios
methods: { itemShow() { this.$axios.get('item/item/'+this.id+'?token='+this.$store.state.token).then(ret => { console.log(ret) }) }, }, watch: { '$route.path'(newVal,oldVal) { if (newVal) { this.itemShow() } } },