flex.uvue 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <template>
  2. <!-- #ifdef APP -->
  3. <scroll-view style="flex: 1">
  4. <!-- #endif -->
  5. <view style="flex-grow: 1">
  6. <view>
  7. <text>flex: 0</text>
  8. <view style="
  9. width: 250px;
  10. height: 150px;
  11. background-color: gray;
  12. flex-direction: row;
  13. ">
  14. <view class="common" style="min-width: 25px; flex: 0"></view>
  15. <view style="width: 50px; height: 50px; background-color: green"></view>
  16. <view style="width: 50px; height: 50px; background-color: blue"></view>
  17. </view>
  18. </view>
  19. <view>
  20. <text>flex: 1</text>
  21. <view style="
  22. width: 250px;
  23. height: 150px;
  24. background-color: gray;
  25. flex-direction: row;
  26. ">
  27. <view class="common" style="flex: 1"></view>
  28. <view style="width: 50px; height: 50px; background-color: green"></view>
  29. <view style="width: 50px; height: 50px; background-color: blue"></view>
  30. </view>
  31. </view>
  32. <view>
  33. <text>flex: auto</text>
  34. <view style="
  35. width: 250px;
  36. height: 150px;
  37. background-color: gray;
  38. flex-direction: row;
  39. ">
  40. <view class="common" style="flex: auto"></view>
  41. <view style="width: 50px; height: 50px; background-color: green"></view>
  42. <view style="width: 50px; height: 50px; background-color: blue"></view>
  43. </view>
  44. </view>
  45. <view>
  46. <text>flex: none</text>
  47. <view style="
  48. width: 250px;
  49. height: 150px;
  50. background-color: gray;
  51. flex-direction: row;
  52. ">
  53. <view class="common" style="flex: none"></view>
  54. <view style="width: 50px; height: 50px; background-color: green"></view>
  55. <view style="width: 50px; height: 50px; background-color: blue"></view>
  56. </view>
  57. </view>
  58. </view>
  59. <!-- #ifdef APP -->
  60. </scroll-view>
  61. <!-- #endif -->
  62. </template>
  63. <style>
  64. .common {
  65. width: 50px;
  66. height: 50px;
  67. background-color: red;
  68. }
  69. </style>