直接用用number.toFixed(2)即可

 

<template>
  <section class="p-10">
    <h1> {{ number }} </h1>
  </section>
</template>
<script>
  export default {
    data() {
      return {
        number: 3.1415926
      };
    },
    created() {
      this.number = this.number.toFixed(2);
    }
  }
</script>

<style lang="scss">
</style>

 

 

嗯,就酱~~

相关文章:

  • 2021-06-02
  • 2021-11-18
  • 2021-12-18
  • 2021-12-18
  • 2021-08-21
  • 2022-02-27
猜你喜欢
  • 2022-12-23
  • 2021-12-18
  • 2021-11-24
  • 2021-06-18
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案