Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
monorepo
/
venus
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
1
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit b78bc65c
authored
Jun 29, 2025
by
chewenye
Committed by
GitHub
Jun 29, 2025
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat: 组件json-viewer支持bigint数据显示 cwy (#6377)
Co-authored-by: 车文烨 <chewy@china-lehua.com>
1 parent
b1fb6231
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
0 deletions
packages/effects/common-ui/package.json
packages/effects/common-ui/src/components/json-viewer/index.vue
pnpm-lock.yaml
packages/effects/common-ui/package.json
View file @
b78bc65
...
@@ -40,6 +40,7 @@
...
@@ -40,6 +40,7 @@
"@vben/types"
:
"workspace:*"
,
"@vben/types"
:
"workspace:*"
,
"@vueuse/core"
:
"catalog:"
,
"@vueuse/core"
:
"catalog:"
,
"@vueuse/integrations"
:
"catalog:"
,
"@vueuse/integrations"
:
"catalog:"
,
"json-bigint"
:
"catalog:"
,
"qrcode"
:
"catalog:"
,
"qrcode"
:
"catalog:"
,
"tippy.js"
:
"catalog:"
,
"tippy.js"
:
"catalog:"
,
"vue"
:
"catalog:"
,
"vue"
:
"catalog:"
,
...
...
packages/effects/common-ui/src/components/json-viewer/index.vue
View file @
b78bc65
...
@@ -18,6 +18,9 @@ import { $t } from '@vben/locales';
...
@@ -18,6 +18,9 @@ import { $t } from '@vben/locales';
import
{
isBoolean
}
from
'@vben-core/shared/utils'
;
import
{
isBoolean
}
from
'@vben-core/shared/utils'
;
// @ts-ignore
import
JsonBigint
from
'json-bigint'
;
defineOptions
({
name
:
'JsonViewer'
});
defineOptions
({
name
:
'JsonViewer'
});
const
props
=
withDefaults
(
defineProps
<
JsonViewerProps
>
(),
{
const
props
=
withDefaults
(
defineProps
<
JsonViewerProps
>
(),
{
...
@@ -68,6 +71,20 @@ function handleClick(event: MouseEvent) {
...
@@ -68,6 +71,20 @@ function handleClick(event: MouseEvent) {
emit
(
'click'
,
event
);
emit
(
'click'
,
event
);
}
}
// 支持显示 bigint 数据,如较长的订单号
const
jsonData
=
computed
<
Record
<
string
,
any
>>
(()
=>
{
if
(
typeof
props
.
value
!==
'string'
)
{
return
props
.
value
||
{};
}
try
{
return
JsonBigint
({
storeAsString
:
true
}).
parse
(
props
.
value
);
}
catch
(
error
)
{
console
.
error
(
'JSON parse error:'
,
error
);
return
{};
}
});
const
bindProps
=
computed
<
Recordable
<
any
>>
(()
=>
{
const
bindProps
=
computed
<
Recordable
<
any
>>
(()
=>
{
const
copyable
=
{
const
copyable
=
{
copyText
:
$t
(
'ui.jsonViewer.copy'
),
copyText
:
$t
(
'ui.jsonViewer.copy'
),
...
@@ -79,6 +96,7 @@ const bindProps = computed<Recordable<any>>(() => {
...
@@ -79,6 +96,7 @@ const bindProps = computed<Recordable<any>>(() => {
return
{
return
{
...
props
,
...
props
,
...
attrs
,
...
attrs
,
value
:
jsonData
.
value
,
onCopied
:
(
event
:
JsonViewerAction
)
=>
emit
(
'copied'
,
event
),
onCopied
:
(
event
:
JsonViewerAction
)
=>
emit
(
'copied'
,
event
),
onKeyclick
:
(
key
:
string
)
=>
emit
(
'keyClick'
,
key
),
onKeyclick
:
(
key
:
string
)
=>
emit
(
'keyClick'
,
key
),
onClick
:
(
event
:
MouseEvent
)
=>
handleClick
(
event
),
onClick
:
(
event
:
MouseEvent
)
=>
handleClick
(
event
),
...
...
pnpm-lock.yaml
View file @
b78bc65
...
@@ -1554,6 +1554,9 @@ importers:
...
@@ -1554,6 +1554,9 @@ importers:
'
@vueuse/integrations'
:
'
@vueuse/integrations'
:
specifier
:
'
catalog:'
specifier
:
'
catalog:'
version
:
13.1.0(async-validator@4.2.5)(axios@1.9.0)(focus-trap@7.6.4)(jwt-decode@4.0.0)(nprogress@0.2.0)(qrcode@1.5.4)(sortablejs@1.15.6)(vue@3.5.13(typescript@5.8.3))
version
:
13.1.0(async-validator@4.2.5)(axios@1.9.0)(focus-trap@7.6.4)(jwt-decode@4.0.0)(nprogress@0.2.0)(qrcode@1.5.4)(sortablejs@1.15.6)(vue@3.5.13(typescript@5.8.3))
json-bigint
:
specifier
:
'
catalog:'
version
:
1.0.0
qrcode
:
qrcode
:
specifier
:
'
catalog:'
specifier
:
'
catalog:'
version
:
1.5.4
version
:
1.5.4
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment