ZengTao
2023-09-06 ef70db354165ae7d5e79f44da820c063df71e423
CanadaMes-ui/src/store/module/tags.js
@@ -1,6 +1,6 @@
const state = {
  tags: []
};
}
const mutations = {
  addTag(state, tag) {
@@ -8,15 +8,20 @@
      state.tags.push(tag);
    }
  },
  removeTag(state, tag) {
    const index = state.tags.indexOf(tag);
    if (index !== -1) {
      state.tags.splice(index, 1);
    }
  removeTag(state, index) {
    state.tags.splice(index, 1);
  },
  removeAllTags(state) {
    state.tags = [];
  },
  switchTag(tag) {
    this.$emit('switchTag', tag);
    this.$router.push('/' + tag); // 添加这行代码以切换路由
  }
};
}
export default {
  namespaced: true,
  state,
  mutations
};
}