tabLeft2.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <template>
  2. <div class="left">
  3. <ul>
  4. <li :class="{active:ind===item.id}" v-for="(item, index) in tabList" :key="index" @click="skip(item.id)">
  5. <i :class="item.inon"></i>
  6. {{ item.name }}
  7. </li>
  8. </ul>
  9. </div>
  10. </template>
  11. <script>
  12. export default {
  13. components: {},
  14. props: {
  15. ind: {
  16. type: Number,
  17. default: 0
  18. }
  19. },
  20. data () {
  21. return {
  22. tabList: [
  23. { name: '征集品总账', id: 0, inon: 'el-icon-s-order' },
  24. { name: '征集品提用', id: 1, inon: 'el-icon-caret-left' },
  25. { name: '征集品注销', id: 2, inon: 'el-icon-delete-solid' }
  26. ]
  27. }
  28. },
  29. methods: {
  30. skip (index) {
  31. this.$router.push(`/layout/collect${index}`).catch(() => {})
  32. // 如果从别的tab栏点击藏品总账,就自动刷新页面获取最新信息
  33. this.$nextTick(() => {
  34. setTimeout(() => {
  35. if (this.ind !== index && index === 0) location.reload(true)
  36. }, 200)
  37. })
  38. }
  39. }
  40. }
  41. </script>
  42. <style lang='less' scoped>
  43. .left {
  44. width: 220px;
  45. min-width: 130px;
  46. height: 868px;
  47. background-color: #fff;
  48. box-shadow: 1px 1px 10px 1px;
  49. ul {
  50. li {
  51. cursor: pointer;
  52. color: black;
  53. font-size: 16px;
  54. height: 60px;
  55. display: flex;
  56. align-items: center;
  57. i {
  58. margin: 0 18px;
  59. }
  60. }
  61. li:hover{
  62. background:#e6f7ff ;
  63. }
  64. .active {
  65. background:#e6f7ff ;
  66. }
  67. }
  68. }</style>