overflow.uvue 3.7 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
          <image style="width: 150px; height: 150px;" src="/static/uni.png"></image>
        </view>
58 59 60 61 62 63 64
      </view>
      <text style="font-size: 15px;">overflow=visible效果 子元素是view 父是scroll-view</text>
      <scroll-view class="backgroundview">
        <view class="box-visible-border-radius">
          <view style="width: 50px; height: 150px; background-color: greenyellow;"></view>
        </view>
      </scroll-view>
shutao-dc's avatar
shutao-dc 已提交
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 93 94

    </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 已提交
95
  .box-hidden-border-radius {
shutao-dc's avatar
shutao-dc 已提交
96 97 98 99 100
    width: 100px;
    height: 100px;
    border-radius: 20px;
    overflow: hidden;
    background-color: green;
shutao-dc's avatar
shutao-dc 已提交
101 102 103 104 105 106 107 108
  }

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

shutao-dc's avatar
shutao-dc 已提交
111
  .box-visible-border-radius {
shutao-dc's avatar
shutao-dc 已提交
112 113 114 115 116
    width: 100px;
    height: 100px;
    border-radius: 20px;
    overflow: visible;
    background-color: green;
shutao-dc's avatar
shutao-dc 已提交
117 118 119 120 121 122 123 124 125
  }

  .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 已提交
126 127 128
  }

  .text1 {
129 130
    font-size: 50px;
    lines: 1;
shutao-dc's avatar
shutao-dc 已提交
131 132
  }
</style>