需求是当vuex中存储的PageId 发生变化,则让定义的index的值等于 PageId,那么就得实时监听PageId的变化
computed 中
computed: {
	monitor () {
		return this.$store.state.PageId
	}
}
watch 中
watch: {
	monitor () {
		this.index = this.$store.state.PageId
	}
}
computed 和 watch 中必须定义的函数名一样,如上代码 computed 中为 monitor,那么 watch 中也需一样为 monitor