enter-navigator.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <template>
  2. <view class="container">
  3. <view class="robot">
  4. <image src="../../static/nav_robot.png" mode="aspectFit"></image>
  5. </view>
  6. <view class="titleText">SmartAssistant</view>
  7. <view class="selectContent">
  8. <view class="select_box" v-for="(item, index) in dataList" :key="index" @click="clickToItem(item, index)">
  9. {{ item }}
  10. </view>
  11. </view>
  12. <view class="userInfo">
  13. <view class="user_regist" @click="clickToRegist">注册</view>
  14. <view class="user_login" @click="clickToLogin">登录</view>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. export default {
  20. data() {
  21. return {
  22. dataList: ['首页', 'AI聊天', 'AI画图'],
  23. currenIndex: this.selectedIndex
  24. }
  25. },
  26. props: {
  27. selectedIndex: {
  28. type: Number,
  29. default: 0
  30. }
  31. },
  32. mounted() {
  33. this.$emit('clickToIndex', this.currenIndex)
  34. },
  35. methods:{
  36. clickToItem(item, index) {
  37. if(this.currenIndex === index) {
  38. return
  39. }
  40. this.currenIndex = index
  41. this.$emit('clickToIndex', index)
  42. },
  43. clickToRegist() {
  44. },
  45. clickToLogin() {
  46. }
  47. }
  48. }
  49. </script>
  50. <style lang="scss">
  51. .container{
  52. position: fixed;
  53. width: 100%;
  54. height: 60px;
  55. top: 0%;
  56. left: 0;
  57. background: linear-gradient(to right, #303373, #C9A391);
  58. display: flex;
  59. box-sizing: border-box;
  60. align-items: center;
  61. .robot{
  62. flex-shrink: 0;
  63. width: 48px;
  64. height: 48px;
  65. margin-left: 15px;
  66. image{
  67. width: 100%;
  68. height: 100%;
  69. }
  70. }
  71. .titleText{
  72. display: flex;
  73. margin-left: 10px;
  74. // height: 100%;
  75. font-size: 30px;
  76. font-weight: 500;
  77. color: #ffffff;
  78. }
  79. .selectContent{
  80. display: flex;
  81. flex-direction: row;
  82. height: 100%;
  83. align-items: center;
  84. .select_box{
  85. display: flex;
  86. margin-left: 40px;
  87. color: #ffffff;
  88. }
  89. }
  90. .userInfo{
  91. position: absolute;
  92. display: flex;
  93. box-sizing: border-box;
  94. height: 100%;
  95. top: 0px;
  96. right: 15px;
  97. align-items: center;
  98. .user_regist{
  99. display: flex;
  100. width: 65px;
  101. height: 28px;
  102. border-radius: 28px;
  103. color: #878787;
  104. background-color: #ffffff;
  105. justify-content: center;
  106. align-items: center;
  107. }
  108. .user_login{
  109. display: flex;
  110. width: 65px;
  111. height: 28px;
  112. border-radius: 28px;
  113. color: #ffffff;
  114. background-color: #4C9CF1;
  115. justify-content: center;
  116. align-items: center;
  117. margin-left: 15px;
  118. }
  119. }
  120. }
  121. </style>