overflow.uvue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <template>
  2. <!-- #ifdef APP -->
  3. <scroll-view style="flex:1;">
  4. <!-- #endif -->
  5. <text style="font-size: 15px;">overflow=hidden效果子元素是view border圆角</text>
  6. <view class="backgroundview">
  7. <view class="box-hidden-border-radius">
  8. <view style="width: 50px; height: 150px; background-color: greenyellow;"></view>
  9. </view>
  10. </view>
  11. <text style="font-size: 15px;">overflow=hidden效果 子元素是view border边框</text>
  12. <view class="backgroundview">
  13. <view class="box-hidden-border-width">
  14. <view style="width: 50px; height: 150px; background-color: greenyellow;"></view>
  15. </view>
  16. </view>
  17. <text style="font-size: 15px;">overflow=visible效果 子元素是view border圆角</text>
  18. <view class="backgroundview">
  19. <view class="box-visible-border-radius">
  20. <view style="width: 50px; height: 150px; background-color: greenyellow;"></view>
  21. </view>
  22. </view>
  23. <text style="font-size: 15px;">overflow=visible效果 子元素是view border边框</text>
  24. <view class="backgroundview">
  25. <view class="box-visible-border-width">
  26. <view style="width: 50px; height: 150px; background-color: greenyellow;"></view>
  27. </view>
  28. </view>
  29. <view style="flex-grow: 1">
  30. <text style="font-size: 15px;">overflow=hidden效果 子元素是text</text>
  31. <view class="backgroundview">
  32. <view class="box-hidden-border-radius">
  33. <text class="text1">ABCDEFG</text>
  34. </view>
  35. </view>
  36. <text style="font-size: 15px;">overflow=visible效果 子元素是text</text>
  37. <view class="backgroundview">
  38. <view class="box-visible-border-radius">
  39. <text class="text1">ABCDEFG</text>
  40. </view>
  41. </view>
  42. <text style="font-size: 15px;">overflow=hidden效果 子元素是image</text>
  43. <view class="backgroundview">
  44. <view class="box-hidden-border-radius">
  45. <image style="width: 150px; height: 150px;" src="/static/uni.png"></image>
  46. </view>
  47. </view>
  48. <text style="font-size: 15px;">overflow=visible效果 子元素是image</text>
  49. <view class="backgroundview">
  50. <view class="box-visible-border-radius">
  51. <image style="width: 150px; height: 150px;" src="/static/uni.png"></image>
  52. </view>
  53. </view>
  54. <text style="font-size: 15px;">overflow=visible效果 子元素是view 父是scroll-view</text>
  55. <scroll-view class="backgroundview">
  56. <view class="box-visible-border-radius">
  57. <view style="width: 50px; height: 150px; background-color: greenyellow;"></view>
  58. </view>
  59. </scroll-view>
  60. <text style="font-size: 15px;">overflow=visible 设置阴影显示文字</text>
  61. <view class="backgroundview">
  62. <view class="" style="overflow: visible;width: 100px;height: 100px;background-color: green;box-shadow: 10px 10px #000;margin-top: 10px;">
  63. <text style="width:170px; background-color: greenyellow;">文字文字文字文字文字</text>
  64. </view>
  65. </view>
  66. </view>
  67. <!-- #ifdef APP -->
  68. </scroll-view>
  69. <!-- #endif -->
  70. </template>
  71. <script>
  72. export default {
  73. data() {
  74. return {
  75. }
  76. },
  77. methods: {
  78. }
  79. }
  80. </script>
  81. <style>
  82. .backgroundview {
  83. width: 300px;
  84. height: 300px;
  85. margin-bottom: 20px;
  86. background-color: white;
  87. justify-content: center;
  88. align-items: center;
  89. }
  90. .box-hidden-border-radius {
  91. width: 100px;
  92. height: 100px;
  93. border-radius: 20px;
  94. overflow: hidden;
  95. background-color: green;
  96. }
  97. .box-hidden-border-width {
  98. width: 100px;
  99. height: 100px;
  100. border-width: 2px;
  101. border-style: solid;
  102. background-color: green;
  103. }
  104. .box-visible-border-radius {
  105. width: 100px;
  106. height: 100px;
  107. border-radius: 20px;
  108. overflow: visible;
  109. background-color: green;
  110. }
  111. .box-visible-border-width {
  112. width: 100px;
  113. height: 100px;
  114. border-width: 2px;
  115. border-style: solid;
  116. overflow: visible;
  117. background-color: green;
  118. }
  119. .text1 {
  120. font-size: 50px;
  121. lines: 1;
  122. }
  123. </style>