index.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <template>
  2. <gui-page :customFooter="true" iphoneXButtomStyle="background:#F8F8F8"
  3. :footerSets="{height:150, zIndex:100, bg:'none'}">
  4. <!-- 页面主体 -->
  5. <view slot="gBody" class="gui-margin">
  6. <gui-demo-banner title="GraceUI · FLEX 布局"
  7. img="https://cmsuse.oss-cn-beijing.aliyuncs.com/g5/8.png"
  8. desc="利用内置 Flex 样式灵活组合, 快速实现"></gui-demo-banner>
  9. <view class="gui-margin-top">
  10. <text class="gui-h5 gui-color-gray gui-bold">横向缩放</text>
  11. </view>
  12. <view style="margin-top:15rpx" class="gui-flex gui-rows gui-nowrap">
  13. <view class="gui-text-small demo gui-bg-gray gui-color-gray">GraceUI</view>
  14. <view class="gui-text-small demo gui-bg-gray gui-color-gray">GraceUI</view>
  15. <view class="gui-text-small demo gui-bg-gray gui-color-gray">GraceUI</view>
  16. <view class="gui-text-small demo gui-bg-gray gui-color-gray">GraceUI</view>
  17. </view>
  18. <view class="gui-margin-top">
  19. <text class="gui-h5 gui-color-gray gui-bold">横向换行</text>
  20. </view>
  21. <view style="margin-top:15rpx" class="gui-flex gui-rows gui-wrap">
  22. <view class="gui-text-small demo gui-bg-gray gui-color-gray">GraceUI</view>
  23. <view class="gui-text-small demo gui-bg-gray gui-color-gray">GraceUI</view>
  24. <view class="gui-text-small demo gui-bg-gray gui-color-gray">GraceUI</view>
  25. <view class="gui-text-small demo gui-bg-gray gui-color-gray">GraceUI</view>
  26. <view class="gui-text-small demo gui-bg-gray gui-color-gray">GraceUI</view>
  27. <view class="gui-text-small demo gui-bg-gray gui-color-gray">GraceUI</view>
  28. </view>
  29. <view class="gui-margin-top">
  30. <text class="gui-h5 gui-color-gray gui-bold">横向两端</text>
  31. </view>
  32. <view style="margin-top:15rpx" class="gui-flex gui-rows gui-space-between">
  33. <view class="gui-text-small demo gui-bg-gray gui-color-gray">GraceUI</view>
  34. <view class="gui-text-small demo gui-bg-gray gui-color-gray">GraceUI</view>
  35. </view>
  36. <view class="gui-margin-top">
  37. <text class="gui-h5 gui-color-gray gui-bold">自动宽度</text>
  38. </view>
  39. <view style="margin-top:15rpx" class="gui-flex gui-rows gui-nowrap">
  40. <view class="gui-text-small demo gui-bg-gray gui-color-gray">GraceUI</view>
  41. <view class="gui-text-small demo gui-bg-gray gui-color-gray gui-flex1">自动宽度元素</view>
  42. </view>
  43. <view class="gui-margin-top">
  44. <text class="gui-h5 gui-color-gray gui-bold">嵌套布局</text>
  45. </view>
  46. <view style="margin-top:15rpx" class="gui-flex gui-rows gui-nowrap">
  47. <view class="gui-text-small demo gui-bg-gray gui-color-gray"
  48. style="height:196rpx; line-height:196rpx;">GraceUI</view>
  49. <view style="flex:1;">
  50. <view class="gui-flex gui-columns">
  51. <view class="demo-auto-width gui-bg-gray gui-color-gray gui-text-small">自动宽度元素</view>
  52. <view class="demo-auto-width gui-bg-gray gui-color-gray gui-text-small">自动宽度元素</view>
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. <!-- 底部插槽实现 -->
  58. <!-- 边框使用 style 实现,可以根据自己项目实际情况修改 -->
  59. <view slot="gFooter" class="gui-flex gui-rows gui-nowrap gui-space-between gui-align-items-end"
  60. style="height:150rpx;">
  61. <view class="gui-footer-icon-buttons" @tap="navChang(0)">
  62. <text class="gui-footer-icon-buttons-icon gui-block-text gui-icons"
  63. :class="[navCurrent == 0 ? 'gui-nav-bottom-active-color' : 'gui-nav-bottom-color']">&#xe63b;</text>
  64. <text class="gui-footer-icon-buttons-text gui-block-text gui-nav-bottom-color"
  65. :class="[navCurrent == 0 ? 'gui-nav-bottom-active-color' : 'gui-nav-bottom-color']">首页</text>
  66. </view>
  67. <view class="gui-footer-icon-buttons" @tap="navChang(1)">
  68. <text class="gui-footer-icon-buttons-icon gui-block-text gui-icons"
  69. :class="[navCurrent == 1 ? 'gui-nav-bottom-active-color' : 'gui-nav-bottom-color']">&#xe6b8;</text>
  70. <text class="gui-footer-icon-buttons-text gui-block-text gui-nav-bottom-color"
  71. :class="[navCurrent == 1 ? 'gui-nav-bottom-active-color' : 'gui-nav-bottom-color']">交流</text>
  72. </view>
  73. <!-- 凸出按钮占位 普通按钮 实现下面的 gui-footer-icon-buttons 即可 -->
  74. <view class="gui-footer-icon-buttons"></view>
  75. <view class="gui-footer-icon-buttons" @tap="navChang(3)">
  76. <text class="gui-footer-icon-buttons-icon gui-block-text gui-icons"
  77. :class="[navCurrent == 3 ? 'gui-nav-bottom-active-color' : 'gui-nav-bottom-color']">&#xe626;</text>
  78. <text class="gui-footer-icon-buttons-text gui-block-text"
  79. :class="[navCurrent == 3 ? 'gui-nav-bottom-active-color' : 'gui-nav-bottom-color']">客服</text>
  80. </view>
  81. <view class="gui-footer-icon-buttons" @tap="navChang(4)">
  82. <text class="gui-footer-icon-buttons-icon gui-block-text gui-icons"
  83. :class="[navCurrent == 4 ? 'gui-nav-bottom-active-color' : 'gui-nav-bottom-color']">&#xe6fe;</text>
  84. <text class="gui-footer-icon-buttons-text gui-block-text"
  85. :class="[navCurrent == 4 ? 'gui-nav-bottom-active-color' : 'gui-nav-bottom-color']">我的</text>
  86. </view>
  87. <!-- 使用定位方式实现凸出按钮 -->
  88. <view class="gui-footer-buttons-ab" @tap="navChang(2)">
  89. <text class="gui-footer-buttons-ab-icon gui-block-text gui-icons gui-bold"
  90. :class="[navCurrent == 2 ? 'gui-nav-bottom-active-color' : 'gui-nav-bottom-color']">&#xe60b;</text>
  91. <text class="gui-footer-icon-buttons-text gui-block-text"
  92. :class="[navCurrent == 2 ? 'gui-nav-bottom-active-color' : 'gui-nav-bottom-color']">合小记</text>
  93. </view>
  94. </view>
  95. </gui-page>
  96. </template>
  97. <script>
  98. export default {
  99. data() {
  100. return {
  101. navCurrent: 0
  102. }
  103. },
  104. onShow() {
  105. this.navCurrent = 0;
  106. },
  107. methods: {
  108. navChang : function (index) {
  109. this.navCurrent = index;
  110. if (index == 2) {
  111. this.Dever.location('index/list');
  112. }
  113. }
  114. }
  115. }
  116. </script>
  117. <style>
  118. .demo{width:210rpx; height:88rpx; line-height:88rpx; text-align:center; margin:10rpx;}
  119. .demo-auto-width{height:88rpx; line-height:88rpx; text-align:center; margin:10rpx;}
  120. .gui-text-small{font-size:20rpx;}
  121. .gui-footer-icon-buttons{width:130rpx; height:80rpx; padding:10rpx; flex:1; position:relative; margin:0; background-color:#F8F8F8;}
  122. .gui-footer-buttons-ab{position:absolute; z-index:101; left:325rpx; top:0rpx; width:110rpx; height:150rpx;}
  123. .gui-footer-buttons-ab-icon{width:110rpx; height:110rpx; line-height:120rpx; text-align:center; font-size:68rpx; background-color:#F7F8FA; border-radius:100rpx;}
  124. </style>