overflow.uvue 3.4 KB
Newer Older
shutao-dc's avatar
shutao-dc 已提交
1 2 3 4
<template>
  <!-- #ifdef APP -->
  <scroll-view style="flex:1;">
  <!-- #endif -->
shutao-dc's avatar
shutao-dc 已提交
5
    <text style="font-size: 15px;">overflow=hidden效果子元素是view border圆角</text>
shutao-dc's avatar
shutao-dc 已提交
6
    <view class="backgroundview">
shutao-dc's avatar
shutao-dc 已提交
7
      <view class="box-hidden-border-radius">
shutao-dc's avatar
shutao-dc 已提交
8 9
        <view style="width: 50px; height: 150px; background-color: greenyellow;"></view>
      </view>
shutao-dc's avatar
shutao-dc 已提交
10 11 12 13 14 15 16 17 18 19
    </view>

    <text style="font-size: 15px;">overflow=hidden效果 子元素是view border边框</text>
    <view class="backgroundview">
      <view class="box-hidden-border-width">
        <view style="width: 50px; height: 150px; background-color: greenyellow;"></view>
      </view>
    </view>

    <text style="font-size: 15px;">overflow=visible效果 子元素是view border圆角</text>
shutao-dc's avatar
shutao-dc 已提交
20
    <view class="backgroundview">
shutao-dc's avatar
shutao-dc 已提交
21
      <view class="box-visible-border-radius">
shutao-dc's avatar
shutao-dc 已提交
22 23
        <view style="width: 50px; height: 150px; background-color: greenyellow;"></view>
      </view>
shutao-dc's avatar
shutao-dc 已提交
24 25 26 27 28 29 30 31 32
    </view>

    <text style="font-size: 15px;">overflow=visible效果 子元素是view border边框</text>
    <view class="backgroundview">
      <view class="box-visible-border-width">
        <view style="width: 50px; height: 150px; background-color: greenyellow;"></view>
      </view>
    </view>

shutao-dc's avatar
shutao-dc 已提交
33 34 35
    <view style="flex-grow: 1">
      <text style="font-size: 15px;">overflow=hidden效果 子元素是text</text>
      <view class="backgroundview">
shutao-dc's avatar
shutao-dc 已提交
36
        <view class="box-hidden-border-radius">
shutao-dc's avatar
shutao-dc 已提交
37 38 39 40 41
          <text class="text1">ABCDEFG</text>
        </view>
      </view>
      <text style="font-size: 15px;">overflow=visible效果 子元素是text</text>
      <view class="backgroundview">
shutao-dc's avatar
shutao-dc 已提交
42
        <view class="box-visible-border-radius">
shutao-dc's avatar
shutao-dc 已提交
43 44 45 46 47 48
          <text class="text1">ABCDEFG</text>
        </view>
      </view>

      <text style="font-size: 15px;">overflow=hidden效果 子元素是image</text>
      <view class="backgroundview">
shutao-dc's avatar
shutao-dc 已提交
49
        <view class="box-hidden-border-radius">
shutao-dc's avatar
shutao-dc 已提交
50 51 52 53 54
          <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">
shutao-dc's avatar
shutao-dc 已提交
55
        <view class="box-visible-border-radius">
shutao-dc's avatar
shutao-dc 已提交
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
          <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;
  }

shutao-dc's avatar
shutao-dc 已提交
89
  .box-hidden-border-radius {
shutao-dc's avatar
shutao-dc 已提交
90 91 92 93 94
    width: 100px;
    height: 100px;
    border-radius: 20px;
    overflow: hidden;
    background-color: green;
shutao-dc's avatar
shutao-dc 已提交
95 96 97 98 99 100 101 102
  }

  .box-hidden-border-width {
    width: 100px;
    height: 100px;
    border-width: 2px;
    border-style: solid;
    background-color: green;
shutao-dc's avatar
shutao-dc 已提交
103 104
  }

shutao-dc's avatar
shutao-dc 已提交
105
  .box-visible-border-radius {
shutao-dc's avatar
shutao-dc 已提交
106 107 108 109 110
    width: 100px;
    height: 100px;
    border-radius: 20px;
    overflow: visible;
    background-color: green;
shutao-dc's avatar
shutao-dc 已提交
111 112 113 114 115 116 117 118 119
  }

  .box-visible-border-width {
    width: 100px;
    height: 100px;
    border-width: 2px;
    border-style: solid;
    overflow: visible;
    background-color: green;
shutao-dc's avatar
shutao-dc 已提交
120 121 122 123 124 125
  }

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