overflow.uvue 2.4 KB
Newer Older
shutao-dc's avatar
shutao-dc 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
<template>
  <!-- #ifdef APP -->
  <scroll-view style="flex:1;">
  <!-- #endif -->
    <text style="font-size: 15px;">overflow=hidden效果 子元素是view</text>
    <view class="backgroundview">
      <view class="box-hidden">
        <view style="width: 50px; height: 150px; background-color: greenyellow;"></view>
      </view>
    </view>
    <text style="font-size: 15px;">overflow=visible效果 子元素是view</text>
    <view class="backgroundview">
      <view class="box-visible">
        <view style="width: 50px; height: 150px; background-color: greenyellow;"></view>
      </view>
    </view>
    <view style="flex-grow: 1">
      <text style="font-size: 15px;">overflow=hidden效果 子元素是text</text>
      <view class="backgroundview">
        <view class="box-hidden">
          <text class="text1">ABCDEFG</text>
        </view>
      </view>
      <text style="font-size: 15px;">overflow=visible效果 子元素是text</text>
      <view class="backgroundview">
        <view class="box-visible">
          <text class="text1">ABCDEFG</text>
        </view>
      </view>

      <text style="font-size: 15px;">overflow=hidden效果 子元素是image</text>
      <view class="backgroundview">
        <view class="box-hidden">
          <image style="width: 150px; height: 150px;" src="/static/uni.png"></image>
        </view>
      </view>
      <text style="font-size: 15px;">overflow=visible效果 子元素是image</text>
      <view class="backgroundview">
        <view class="box-visible">
          <image style="width: 150px; height: 150px;" src="/static/uni.png"></image>
        </view>
      </view>

    </view>
  <!-- #ifdef APP -->
  </scroll-view>
  <!-- #endif -->
</template>

<script>
  export default {
    data() {
      return {

      }
    },
    methods: {

    }
  }
</script>

<style>
  .backgroundview {
    width: 300px;
    height: 300px;
    margin-bottom: 20px;
    background-color: white;
    justify-content: center;
    align-items: center;
  }

  .box-hidden {
    width: 100px;
    height: 100px;
    border-radius: 20px;
    overflow: hidden;
    background-color: green;
  }

  .box-visible {
    width: 100px;
    height: 100px;
    border-radius: 20px;
    overflow: visible;
    background-color: green;
  }

  .text1 {
    font-size: 50px;
  }
</style>