index.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <template>
  2. <div class="box">
  3. <template v-for="(item, index) in title">
  4. <span
  5. :class="{ active: index === currentIndex, title: true }"
  6. @click="changeColor(index)"
  7. >{{ item }}</span
  8. >
  9. <el-divider
  10. v-if="index < title.length - 1"
  11. direction="vertical"
  12. ></el-divider>
  13. </template>
  14. <div class="">
  15. {{ msg }}
  16. </div>
  17. </div>
  18. </template>
  19. <script>
  20. export default {
  21. name: "goods-classify",
  22. data() {
  23. return {
  24. msg: "000000",
  25. title: ["待提交", "待审核", "待发送", "历史"],
  26. currentIndex: 0,
  27. };
  28. },
  29. methods: {
  30. changeColor(index) {
  31. this.currentIndex = index;
  32. switch (index) {
  33. case 0:
  34. this.msg = "000000";
  35. break;
  36. case 1:
  37. this.msg = "11111";
  38. break;
  39. case 2:
  40. this.msg = "2222222";
  41. break;
  42. case 3:
  43. this.msg = "3333333";
  44. break;
  45. default:
  46. this.msg = "000000";
  47. break;
  48. }
  49. },
  50. },
  51. };
  52. </script>
  53. <style lang="scss" scoped>
  54. .box {
  55. height: 100vh;
  56. width: 100%;
  57. .title {
  58. display: inline-block;
  59. font-size: 17px;
  60. }
  61. .el-divider--vertical {
  62. margin: 0 34px;
  63. }
  64. .active {
  65. color: red;
  66. }
  67. }
  68. </style>