button.uvue 3.1 KB
Newer Older
Y
init  
yurj26 已提交
1
<template>
DCloud-WZF's avatar
DCloud-WZF 已提交
2 3 4
  <!-- #ifdef APP -->
  <scroll-view style="flex: 1">
    <!-- #endif -->
Y
init  
yurj26 已提交
5
    <view>
DCloud-WZF's avatar
DCloud-WZF 已提交
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
      <page-head :title="title"></page-head>
      <view class="uni-padding-wrap uni-common-mt">
        <button
          :type="type"
          :size="size"
          :plain="plain"
          :disabled="disabled"
          class="button test-button"
        >
          页面主操作 Normal
        </button>
        <!-- <button type="primary" :loading="loading" class="button">页面主操作 Loading</button> -->
        <button type="primary" :disabled="true" class="button">
          页面主操作 Disabled
        </button>
Y
init  
yurj26 已提交
21

DCloud-WZF's avatar
DCloud-WZF 已提交
22 23 24 25 26 27
        <button type="default" class="button default-button" @click="addCount">
          页面次要操作 Normal
        </button>
        <button type="default" :disabled="true" class="button disabled-button">
          页面次要操作 Disabled
        </button>
Y
init  
yurj26 已提交
28

DCloud-WZF's avatar
DCloud-WZF 已提交
29 30 31 32
        <button type="warn" class="button">警告类操作 Normal</button>
        <button type="warn" :disabled="true" class="button">
          警告类操作 Disabled
        </button>
Y
init  
yurj26 已提交
33

DCloud-WZF's avatar
DCloud-WZF 已提交
34 35 36 37 38 39 40
        <view class="button-sp-area">
          <button type="primary" :plain="true" class="button text-button">
            {{ text }}
          </button>
          <button type="primary" :disabled="true" :plain="true" class="button">
            不可点击的按钮
          </button>
Y
init  
yurj26 已提交
41

DCloud-WZF's avatar
DCloud-WZF 已提交
42 43 44 45 46 47
          <button type="default" :plain="true" class="button">
            按钮 plain背景镂空
          </button>
          <button type="default" :disabled="true" :plain="true" class="button">
            按钮 Disabled
          </button>
Y
init  
yurj26 已提交
48

DCloud-WZF's avatar
DCloud-WZF 已提交
49 50 51 52 53 54 55 56 57 58 59
          <view class="uni-flex uni-row">
            <button class="button mini-btn" type="primary" size="mini">
              按钮 mini
            </button>
            <button class="button mini-btn" type="default" size="mini">
              按钮 mini
            </button>
            <button class="button mini-btn" type="warn" size="mini">
              按钮 mini
            </button>
          </view>
Y
init  
yurj26 已提交
60
        </view>
DCloud-WZF's avatar
DCloud-WZF 已提交
61
      </view>
Y
init  
yurj26 已提交
62
    </view>
DCloud-WZF's avatar
DCloud-WZF 已提交
63 64 65
    <!-- #ifdef APP -->
  </scroll-view>
  <!-- #endif -->
Y
init  
yurj26 已提交
66 67
</template>
<script lang="ts">
DCloud-WZF's avatar
DCloud-WZF 已提交
68 69 70 71 72 73 74 75 76 77 78 79
export default {
  data() {
    return {
      title: 'button',
      loading: false,
      _timer: 0,
      text: '文字来自data绑定',
      type: 'primary',
      size: 'default',
      plain: false,
      disabled: false,
      count: 0,
Y
init  
yurj26 已提交
80
    }
DCloud-WZF's avatar
DCloud-WZF 已提交
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
  },
  onShow() {
    // this.clearTimer();
    // this._timer = setTimeout(() => {
    //     // this.loading = true;
    // }, 300)
  },
  onUnload() {
    // this.clearTimer();
    // this.loading = false;
  },
  methods: {
    // clearTimer() {
    //     if (this._timer != 0) {
    //         clearTimeout(this._timer);
    //     }
    // }
    addCount() {
      this.count++
    },
  },
}
Y
init  
yurj26 已提交
103 104 105
</script>

<style>
DCloud-WZF's avatar
DCloud-WZF 已提交
106 107 108
.button {
  margin-top: 30rpx;
}
Y
init  
yurj26 已提交
109

DCloud-WZF's avatar
DCloud-WZF 已提交
110 111
.button-sp-area {
  margin: 0 auto;
Y
yurj26 已提交
112
  width: 90%;
DCloud-WZF's avatar
DCloud-WZF 已提交
113
}
Y
init  
yurj26 已提交
114

DCloud-WZF's avatar
DCloud-WZF 已提交
115 116 117 118 119
.mini-btn {
  margin-right: 10rpx;
  margin-bottom: 30rpx;
}
</style>