friend.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <view class="tab-page friend">
  3. <view class="nav-bar">
  4. <view class="nav-search">
  5. <uni-search-bar @focus="onFocusSearch" cancelButton="none" placeholder="点击搜索好友" ></uni-search-bar>
  6. </view>
  7. <view class="nav-add" @click="onAddNewFriends()">
  8. <uni-icons type="personadd" size="30"></uni-icons>
  9. </view>
  10. </view>
  11. <view class="friend-tip" v-if="$store.state.friendStore.friends.length==0">
  12. 温馨提示:您现在还没有任何好友,快点击右上方'+'按钮添加好友吧~
  13. </view>
  14. <view class="friend-items" v-else>
  15. <scroll-view class="scroll-bar" scroll-with-animation="true" scroll-y="true">
  16. <view v-for="(friend,index) in $store.state.friendStore.friends" :key="index">
  17. <friend-item :friend="friend"></friend-item>
  18. </view>
  19. </scroll-view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. export default {
  25. data() {
  26. return {
  27. }
  28. },
  29. methods: {
  30. onFocusSearch() {
  31. uni.navigateTo({
  32. url: "/pages/friend/friend-search"
  33. })
  34. },
  35. onAddNewFriends(){
  36. uni.navigateTo({
  37. url: "/pages/friend/friend-add"
  38. })
  39. }
  40. }
  41. }
  42. </script>
  43. <style lang="scss" scoped>
  44. .friend {
  45. position: relative;
  46. border: #dddddd solid 1px;
  47. display: flex;
  48. flex-direction: column;
  49. .friend-tip{
  50. position: absolute;
  51. top: 400rpx;
  52. padding: 50rpx ;
  53. text-align: center;
  54. line-height: 50rpx;
  55. text-align: left;
  56. color: darkblue;
  57. font-size: 30rpx;
  58. }
  59. .nav-bar {
  60. margin: 5rpx;
  61. display: flex;
  62. align-items: center;
  63. background-color: white;
  64. .nav-search{
  65. flex:1;
  66. }
  67. .nav-add {
  68. line-height: 56px;
  69. cursor: pointer;
  70. }
  71. }
  72. .friend-items {
  73. flex: 1;
  74. padding: 0;
  75. border: #dddddd solid 1px;
  76. overflow: hidden;
  77. position: relative;
  78. .scroll-bar {
  79. height: 100%;
  80. }
  81. }
  82. }
  83. </style>