• 引入
  • 代码演示
    • Roller
    • Carousel
    • Spinner
  • API
    • ActivityIndicator Props

    ActivityIndicator 活动指示器

    Scan me!

    活动指示器,一般用于正在进行中的任务示意

    引入

    1. import { ActivityIndicator } from 'mand-mobile'
    2. Vue.component(ActivityIndicator.name, ActivityIndicator)

    代码演示

    Roller

    ActivityIndicator 活动指示器 - 图2

    1. <template>
    2. <div class="md-example-child md-example-child-md-activity-indicator md-example-child-md-activity-indicator-0">
    3. <md-activity-indicator
    4. :size="20"
    5. :text-size="16"
    6. >加载中...</md-activity-indicator>
    7. <md-activity-indicator
    8. :size="20"
    9. :text-size="16"
    10. vertical
    11. >vertical loading</md-activity-indicator>
    12. <md-activity-indicator
    13. class="md-activity-indicator-css"
    14. >loading...</md-activity-indicator>
    15. </div>
    16. </template>
    17. <script>
    18. import {ActivityIndicator} from 'mand-mobile'
    19. export default {
    20. name: 'activity-indicator-demo',
    21. title: 'Roller',
    22. components: {
    23. [ActivityIndicator.name]: ActivityIndicator,
    24. },
    25. }
    26. </script>
    27. <style lang="stylus">
    28. .md-example-child-md-activity-indicator-0
    29. display flex
    30. flex-direction column
    31. align-items center
    32. .md-activity-indicator
    33. margin-bottom 30px
    34. &.md-activity-indicator-css
    35. .md-activity-indicator-svg
    36. width 60px !important
    37. height 60px !important
    38. .md-activity-indicator-text
    39. font-size 32px
    40. </style>

    ActivityIndicator 活动指示器 - 图3

            <template>
      <div class="md-example-child md-example-child-md-activity-indicator md-example-child-md-activity-indicator-2">
        <md-activity-indicator
          type="carousel"
          :size="15"
        ></md-activity-indicator>
        <md-button type="primary" @click="createPay">
          <md-activity-indicator
            v-if="loading"
            class="md-activity-indicator-css"
            type="carousel"
            :size="15"
            color="#fff"
            text-color="#fff"
          ></md-activity-indicator>
          <span v-else>确认支付</span>
        </md-button>
        </div>
    </template>
    
    <script>
    import {ActivityIndicator, Button} from 'mand-mobile'
    
    export default {
      name: 'activity-indicator-demo',
      title: 'Carousel',
      components: {
        [ActivityIndicator.name]: ActivityIndicator,
        [Button.name]: Button,
      },
      data() {
        return {
          loading: false,
        }
      },
      methods: {
        createPay() {
          if (this.loading) {
            return
          }
          this.loading = true
          setTimeout(() => {
            this.loading = false
          }, 2000)
        },
      },
    }
    
    </script>
    
    <style lang="stylus">
    .md-example-child-md-activity-indicator-2
      display flex
      flex-direction column
      align-items center
      .md-activity-indicator
        margin-bottom 30px
      .md-button
        width 100%
        .md-activity-indicator-css
          margin-bottom 0
          .md-activity-indicator-svg
            height 15px !important
    </style>
          

    Spinner

    ActivityIndicator 活动指示器 - 图4

            <template>
      <div class="md-example-child md-example-child-md-activity-indicator md-example-child-md-activity-indicator-1">
        <md-activity-indicator
          type="spinner"
          :size="30"
          :text-size="20"
        >加载中...</md-activity-indicator>
        <div class="activity-indicator-container">
          <md-activity-indicator
            class="md-activity-indicator-css"
            type="spinner"
            :size="30"
            :text-size="20"
            color="light"
          >加载中...</md-activity-indicator>
        </div>
        </div>
    </template>
    
    <script>
    import {ActivityIndicator} from 'mand-mobile'
    
    export default {
      name: 'activity-indicator-demo',
      title: 'Spinner',
      components: {
        [ActivityIndicator.name]: ActivityIndicator,
      },
    }
    
    </script>
    
    <style lang="stylus">
    .md-example-child-md-activity-indicator-1
      display flex
      flex-direction column
      align-items center
      .md-activity-indicator
        margin-bottom 30px
      .activity-indicator-container
        margin-bottom 30px
        padding 15px 20px
        background rgba(0, 0, 0, .7)
        border-radius 4px
        .md-activity-indicator-css
          margin-bottom 0
          .md-activity-indicator-svg
            width 40px !important
            height 40px !important
          .md-activity-indicator-text
            font-size 28px !important
    </style>
          

    API

    ActivityIndicator Props

    属性说明类型默认值备注
    type类型Stringrollerroller, spinner, carousel
    size图标大小Number70单位px, 也可直接重置.md-activity-indicator-svg样式
    width图标宽度Number-单位px, 仅用于类型roller
    color图标颜色String#fc9153/darkspinner无法自定义色值,可选值只有darklight
    text-color文字颜色String#999也可直接重置.md-activity-indicator-text样式
    text-size文字大小String70px也可直接重置.md-activity-indicator-text样式
    vertical图标文字是否垂直排列Booleanfalse-