You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

64 lines
1.2 KiB

  1. <template>
  2. <view>
  3. <view class="menu">
  4. <view v-for="item in menuOptions" :key="item.active" :class="{menu_item:true,active:activeIndex==item.active}" @click="()=>{activeIndex = item.active;activeIndexChange(item)}">
  5. {{item.label}}
  6. </view>
  7. </view>
  8. <iframe v-show="activeIndex == 1" src="https://www.baidu.com"></iframe>
  9. <iframe v-show="activeIndex == 2" src="https://www.baidu.com"></iframe>
  10. </view>
  11. </template>
  12. <script>
  13. export default {
  14. data() {
  15. return {
  16. menuOptions:[
  17. {active:1,label:"123"},
  18. {active:2,label:"456"}
  19. ],
  20. activeIndex:1,
  21. }
  22. },
  23. methods: {
  24. // 选项卡改变
  25. activeIndexChange(item){
  26. //
  27. }
  28. },
  29. }
  30. </script>
  31. <style lang="scss" scoped>
  32. .menu{
  33. display: flex;
  34. justify-content: space-between;
  35. background-color: #fff;
  36. border: 1px solid #E4E7ED;
  37. .menu_item{
  38. flex: 1;
  39. text-align: center;
  40. box-sizing: border-box;
  41. line-height: 36px;
  42. border: 1px solid #E4E7ED;
  43. position: relative;
  44. }
  45. .menu_item.active::after{
  46. content: "";
  47. display: block;
  48. background-color: #409EFF;
  49. position: absolute;
  50. width: 50%;
  51. height: 2px;
  52. left: 0;right: 0;
  53. margin: auto;
  54. bottom: 0;
  55. }
  56. }
  57. iframe{
  58. width: 100%;
  59. height: calc(100vh - 40px);
  60. }
  61. </style>