Vue Props 数据数轮

Vue Props data number round

我的原始数据使用来自数据库的 uuid_short() uuid。当我将数据放入 vue 道具时,数字会向上/向下舍入。我该怎么办?

示例:

test.blade.php:

<div class="content-wrapper">
    <div class="content">
        <div class="container-fluid">
            @include('cms.layouts.header', ['module' => 'TEST', 'mode' => 'List'])
            <test-list :test="{{$test}}"></test-list>
        </div>
    </div>
</div>

原始数据:

[{"id":15872,"test_uuid":27091219637075989}]

但在 vue 中,m 显示:test_uuid : 27091219637075988。为什么?

JavaScript 中不丢失精度的 Integer 的最大值是

Number.MAX_SAFE_INTEGER,由于你的uuid值超过了安全范围,会出现精度错误

另一种选择是将其用作字符串或将其转换为 BigInt()