vue3.0 开发小知识集锦

1. 判断div等标签是否显示

v-show="A?true:false"

2. 向下取整

Math.floor(9.9)   // 得到结果:9

3. 向上取整

Math.ceil(9.9)    // 得到结果:10

4. 四舍五入后的整数

Math.round(12.2)    // 得到结果:12

Math.round(12.6)    // 得到结果:13

5. 返回0-1之间的随机小数

Math.random()

6. 返回余弦值或正弦值

Math.cos(5)    // 得到结果:4

Math.sin(5)    // 得到结果:3

posted @ 2021-10-09 13:40  小王同志--  阅读(192)  评论(0)    收藏  举报