border-style.uvue 2.0 KB
Newer Older
DCloud-WZF's avatar
DCloud-WZF 已提交
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
<template>
  <!-- #ifdef APP -->
  <scroll-view style="flex: 1">
  <!-- #endif -->
    <view style="flex-grow: 1">
      <view>
        <text>border-style: dashed</text>
        <view class="common" style="border-width: 5px; border-style: dashed"></view>
      </view>

      <view>
        <text>border-left-style: dashed</text>
        <view class="common" style="border-left-width: 5px; border-left-style: dashed"></view>
      </view>

      <view>
        <text>border-top-style: dashed</text>
        <view class="common" style="border-top-width: 5px; border-top-style: dashed"></view>
      </view>

      <view>
        <text>border-right-style: dotted</text>
        <view class="common" style="border-right-width: 5px; border-right-style: dotted"></view>
      </view>

      <view>
        <text>border-bottom-style: dotted</text>
        <view class="common" style="border-bottom-width: 5px; border-bottom-style: dotted"></view>
      </view>

      <view>
        <text>border-style: solid (缺省 border-width)</text>
        <view class="common" style="border-style: solid;"></view>
      </view>

      <view>
        <text>border-style: none</text>
        <view class="common" style="border-style: none; border-width: 5px;"></view>
      </view>

      <view @click="changeBorderStyle">
        <text>border-style: 点击切换</text>
        <view class="common" :style="borderStyle"></view>
      </view>
    </view>
  <!-- #ifdef APP -->
  </scroll-view>
  <!-- #endif -->
</template>

<script>
  export default {
    data() {
      return {
        isSolid: false,
        borderStyle: "border-style: none; border-width: 5px;",
      }
    },
    methods: {
      changeBorderStyle() {
        this.isSolid = !this.isSolid;
        const solid = "border-style: solid; border-width: 5px;";
        const none = "";
        this.borderStyle = this.isSolid ? solid : none;
      }
    }
  }
</script>

<style>
  .common {
    width: 250px;
    height: 250px;
    background-color: gray;
  }
DCloud-WZF's avatar
DCloud-WZF 已提交
76
</style>