欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

grain-Edu-Note part12 前端后端显示数值小数格式

程序员文章站 2022-04-12 23:39:48
后端查询 c.id, c.title, c.lesson_num AS lessonNum, CONVERT(c.price,DECIMAL (10,2)) AS price, c.cover, c.buy_count AS buyCount, c.view_count AS viewCount, c.status, c.gmt_create AS gmtCreate, t.na...

后端查询

price 一共10位,小数点后2位,小数点前8位

<sql id="columns">
    c.id,
    c.title,
    c.lesson_num AS lessonNum,
    CONVERT(c.price,DECIMAL (8,2)) AS price,
    c.cover,
    c.buy_count AS buyCount,
    c.view_count AS viewCount,
    c.status,
    c.gmt_create AS gmtCreate,
    t.name AS teacherName,
    s1.title AS subjectParentTitle,
    s2.title AS subjectTitle
</sql>

前端显示

<el-tag v-else>{{ Number(scope.row.price).toFixed(1) }}</el-tag>

本文地址:https://blog.csdn.net/Ezerbel/article/details/108977067

相关标签: 实战笔记