width.uvue 989 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <template>
  2. <!-- #ifdef APP -->
  3. <scroll-view style="flex: 1">
  4. <!-- #endif -->
  5. <view style="flex-grow: 1;">
  6. <view>
  7. <text>width: 250px</text>
  8. <view class="common" style="width: 250px;"></view>
  9. </view>
  10. <view style="width: 250px;">
  11. <text>width: 50%</text>
  12. <view class="common" style="width: 50%;"></view>
  13. </view>
  14. <view>
  15. <text>width: 250rpx</text>
  16. <view class="common" style="width: 250rpx;"></view>
  17. </view>
  18. <view class="container">
  19. <text>嵌套子元素测试 v-deep width: 150rpx</text>
  20. <child-width-uvue></child-width-uvue>
  21. </view>
  22. </view>
  23. <!-- #ifdef APP -->
  24. </scroll-view>
  25. <!-- #endif -->
  26. </template>
  27. <script>
  28. import childWidthUvue from "./child-width.uvue";
  29. export default {
  30. components: {
  31. childWidthUvue
  32. }
  33. }
  34. </script>
  35. <style>
  36. .common {
  37. height: 250px;
  38. background-color: red;
  39. }
  40. .container ::v-deep .box {
  41. width: 150px;
  42. height: 150px;
  43. }
  44. </style>