• 引入
  • 提示
  • 代码演示
    • 基本
    • 变化动效
    • 千位分隔符
    • 大写中文
  • API
    • Amount Props

    Amount 金融数字

    Scan me!

    金融数字,一般用于金额,数量等

    引入

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

    提示

    组件中使用字体DINPro-Medium仅用于案例展示,如有必要可重置.md-amountfont-family

    代码演示

    基本

    Amount 金融数字 - 图2

    1. <template>
    2. <div class="md-example-child md-example-child-amount">
    3. <p>
    4. <span class="describe">Original</span>
    5. <md-amount :value="1234.125" :precision="3"></md-amount>
    6. </p>
    7. <p>
    8. <span class="describe">Round</span>
    9. <md-amount :value="1234.125"></md-amount>
    10. </p>
    11. <p>
    12. <span class="describe">Floor</span>
    13. <md-amount :value="1234.123" :is-round-up="false"></md-amount>
    14. </p>
    15. </div>
    16. </template>
    17. <script>
    18. import {Amount} from 'mand-mobile'
    19. export default {
    20. name: 'amount-demo',
    21. components: {
    22. [Amount.name]: Amount,
    23. },
    24. }
    25. </script>
    26. <style lang="stylus" scoped>
    27. .md-example-child-amount
    28. text-align center
    29. color #666
    30. p
    31. font-size 50px
    32. span.describe
    33. font-size 18px
    34. </style>

    变化动效

    Amount 金融数字 - 图3

            <template>
      <div class="md-example-child md-example-child-amount">
        <md-amount
          :value="val"
          :duration="800"
          transition
        ></md-amount>
        </div>
    </template>
    
    <script>
    import {Amount} from 'mand-mobile'
    
    export default {
      name: 'amount-demo',
      components: {
        [Amount.name]: Amount,
      },
      data() {
        return {
          val: 1000,
        }
      },
      mounted() {
        setTimeout(() => {
          this.val = 1500
          setTimeout(() => {
            this.val = 500
          }, 2000)
        }, 2000)
      },
    }
    
    </script>
    
    <style lang="stylus" scoped>
    .md-example-child-amount
      text-align center
      color #666
    </style>
          

    千位分隔符

    Amount 金融数字 - 图4

            <template>
      <div class="md-example-child md-example-child-amount">
        <md-amount
          :value="1234"
          has-separator
        ></md-amount>
        </div>
    </template>
    
    <script>
    import {Amount} from 'mand-mobile'
    
    export default {
      name: 'amount-demo',
      components: {
        [Amount.name]: Amount,
      },
    }
    
    </script>
    
    <style lang="stylus" scoped>
    .md-example-child-amount
      text-align center
      color #666
    </style>
          

    大写中文

    Amount 金融数字 - 图5

            <template>
      <div class="md-example-child md-example-child-amount">
        <md-amount
          :value="1234"
          is-capital
        ></md-amount>
        </div>
    </template>
    
    <script>
    import {Amount} from 'mand-mobile'
    
    export default {
      name: 'amount-demo',
      components: {
        [Amount.name]: Amount,
      },
    }
    
    </script>
    
    <style lang="stylus" scoped>
    .md-example-child-amount
      text-align center
      font-size 32px
      color #666
    </style>
          

    API

    Amount Props

    属性说明类型默认值备注
    value数值Number0-
    precision数字精度Number2小数点后保留几位
    is-round-up数字精度取舍是否四舍五入Booleantrue-
    has-separator数字是否有千位分隔符Booleanfalse-
    separator数字千位分隔符String,-
    is-capital数字是否转换为大写中文Booleanfalse-
    transition数字变化是否使用动画Booleanfalse-
    duration数字变化动画时长Number1000单位ms