diff --git a/auto-imports.d.ts b/auto-imports.d.ts index 10eab88d..1150b743 100644 --- a/auto-imports.d.ts +++ b/auto-imports.d.ts @@ -121,6 +121,7 @@ declare global { const useArrayFilter: typeof import('@vueuse/core')['useArrayFilter'] const useArrayFind: typeof import('@vueuse/core')['useArrayFind'] const useArrayFindIndex: typeof import('@vueuse/core')['useArrayFindIndex'] + const useArrayFindLast: typeof import('@vueuse/core')['useArrayFindLast'] const useArrayJoin: typeof import('@vueuse/core')['useArrayJoin'] const useArrayMap: typeof import('@vueuse/core')['useArrayMap'] const useArrayReduce: typeof import('@vueuse/core')['useArrayReduce'] @@ -423,6 +424,7 @@ declare module 'vue' { readonly useArrayFilter: UnwrapRef readonly useArrayFind: UnwrapRef readonly useArrayFindIndex: UnwrapRef + readonly useArrayFindLast: UnwrapRef readonly useArrayJoin: UnwrapRef readonly useArrayMap: UnwrapRef readonly useArrayReduce: UnwrapRef diff --git a/package.json b/package.json index eab2ae9a..1f17d4ff 100644 --- a/package.json +++ b/package.json @@ -46,10 +46,10 @@ "vite-plugin-vue-layouts": "^0.7.0", "vue": "^3.2.45", "vue-i18n": "^9.2.2", - "vue-json-pretty": "^2.2.4", "vue-prism-component": "^2.0.0", "vue-router": "^4.1.6", "vue3-apexcharts": "^1.4.1", + "vue3-json-viewer": "^2.2.2", "vue3-perfect-scrollbar": "^1.6.1" }, "devDependencies": { @@ -67,8 +67,9 @@ "unplugin-auto-import": "^0.13.0", "unplugin-vue-components": "^0.23.0", "unplugin-vue-define-options": "1.1.4", - "vite": "^4.3.5", + "vite": "^4.4.9", "vite-plugin-pages": "^0.28.0", + "vue-json-viewer": "3", "vue-tsc": "^1.0.12" } } diff --git a/src/modules/[chain]/account/[address].vue b/src/modules/[chain]/account/[address].vue index 5504be06..269d8ca6 100644 --- a/src/modules/[chain]/account/[address].vue +++ b/src/modules/[chain]/account/[address].vue @@ -10,7 +10,7 @@ import DonutChart from '@/components/charts/DonutChart.vue'; import { computed, ref } from '@vue/reactivity'; import { onMounted } from 'vue'; import { Icon } from '@iconify/vue'; -import 'vue-json-pretty/lib/styles.css'; + import type { AuthAccount, Delegation, diff --git a/src/modules/[chain]/tx/[hash].vue b/src/modules/[chain]/tx/[hash].vue index 63b131bd..c8e31786 100644 --- a/src/modules/[chain]/tx/[hash].vue +++ b/src/modules/[chain]/tx/[hash].vue @@ -3,8 +3,10 @@ import { useBlockchain, useFormatter } from '@/stores'; import DynamicComponent from '@/components/dynamic/DynamicComponent.vue'; import { computed, ref } from '@vue/reactivity'; import type { Tx, TxResponse } from '@/types'; -import JsonPretty from 'vue-json-pretty'; -import 'vue-json-pretty/lib/styles.css'; + +import { JsonViewer } from "vue3-json-viewer" +// if you used v1.0.5 or latster ,you should add import "vue3-json-viewer/dist/index.css" +import "vue3-json-viewer/dist/index.css"; const props = defineProps(['hash', 'chain']); @@ -102,7 +104,7 @@ const messages = computed(() => {

JSON

- +
diff --git a/vue3-json-viewer.d.ts b/vue3-json-viewer.d.ts new file mode 100644 index 00000000..af598025 --- /dev/null +++ b/vue3-json-viewer.d.ts @@ -0,0 +1,19 @@ +declare module 'vue3-json-viewer' { + import { AllowedComponentProps, App, Component, ComponentCustomProps, VNodeProps } from 'vue' + interface JsonViewerProps { + value: Object | Array | string | number | boolean; //对象 + expanded: boolean; //是否自动展开 + expandDepth: number; //展开层级 + copyable: boolean | object; //是否可复制 + sort: boolean;//是否排序 + boxed: boolean;//是否boxed + theme: string;//主题 jv-dark | jv-light + previewMode: boolean;//是否可复制 + timeformat: (value: any) => string + } + type JsonViewerType = JsonViewerProps & VNodeProps & AllowedComponentProps & ComponentCustomProps + const JsonViewer: Component + export { JsonViewer } + const def: { install: (app: App) => void } + export default def +} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 25e08104..fa9d2802 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3083,6 +3083,15 @@ cli-width@^2.0.0: resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.1.tgz#b0433d0b4e9c847ef18868a4ef16fd5fc8271c48" integrity sha512-GRMWDxpOB6Dgk2E5Uo+3eEBvtOOlimMmpbFiKuLFnQzYDavtLFY3K5ona41jgN/WdRZtG7utuVSVTL4HbZHGkw== +clipboard@^2.0.10, clipboard@^2.0.4: + version "2.0.11" + resolved "https://registry.yarnpkg.com/clipboard/-/clipboard-2.0.11.tgz#62180360b97dd668b6b3a84ec226975762a70be5" + integrity sha512-C+0bbOqkezLIsmWSvlsXS0Q0bmkugu7jcfMIACB+RDEntIzQIkdr148we28AfSloQLRdZlYL/QYyrq05j/3Faw== + dependencies: + good-listener "^1.2.2" + select "^1.1.2" + tiny-emitter "^2.0.0" + cliui@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/cliui/-/cliui-6.0.0.tgz#511d702c0c4e41ca156d7d0e96021f23e13225b1" @@ -3442,6 +3451,11 @@ delayed-stream@~1.0.0: resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== +delegate@^3.1.2: + version "3.2.0" + resolved "https://registry.yarnpkg.com/delegate/-/delegate-3.2.0.tgz#b66b71c3158522e8ab5744f720d8ca0c2af59166" + integrity sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw== + destr@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/destr/-/destr-2.0.1.tgz#2fc7bddc256fed1183e03f8d148391dde4023cb2" @@ -4088,6 +4102,13 @@ globby@^13.2.2: merge2 "^1.4.1" slash "^4.0.0" +good-listener@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/good-listener/-/good-listener-1.2.2.tgz#d53b30cdf9313dffb7dc9a0d477096aa6d145c50" + integrity sha512-goW1b+d9q/HIwbVYZzZ6SsTr4IgE+WA44A0GmPIQstuOrgsFcT7VEJ48nmr9GaRtNu0XTKacFLGnBPAM6Afouw== + dependencies: + delegate "^3.1.2" + gopd@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.0.1.tgz#29ff76de69dac7489b7c0918a5788e56477c332c" @@ -5934,6 +5955,11 @@ scule@^1.0.0: resolved "https://registry.yarnpkg.com/scule/-/scule-1.0.0.tgz#895e6f4ba887e78d8b9b4111e23ae84fef82376d" integrity sha512-4AsO/FrViE/iDNEPaAQlb77tf0csuq27EsVpy6ett584EcRTp6pTDLoGWVxCD77y5iU5FauOvhsI4o1APwPoSQ== +select@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/select/-/select-1.1.2.tgz#0e7350acdec80b1108528786ec1d4418d11b396d" + integrity sha512-OwpTSOfy6xSs1+pwcNrv0RBMOzI39Lp3qQKUTPVVPRjCdNa5JH/oPRiqsesIskK8TVgmRiHwO4KXlV2Li9dANA== + "semver@2 || 3 || 4 || 5", semver@^5.5.0: version "5.7.2" resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.2.tgz#48d55db737c3287cd4835e17fa13feace1c41ef8" @@ -6409,6 +6435,11 @@ timespan@2.x: resolved "https://registry.yarnpkg.com/timespan/-/timespan-2.3.0.tgz#4902ce040bd13d845c8f59b27e9d59bad6f39929" integrity sha512-0Jq9+58T2wbOyLth0EU+AUb6JMGCLaTWIykJFa7hyAybjVH9gpVMTfUAwo5fWAvtFt2Tjh/Elg8JtgNpnMnM8g== +tiny-emitter@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/tiny-emitter/-/tiny-emitter-2.1.0.tgz#1d1a56edfc51c43e863cbb5382a72330e3555423" + integrity sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q== + tmp@^0.0.33: version "0.0.33" resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" @@ -6708,7 +6739,7 @@ vite-plugin-vue-layouts@^0.7.0: debug "^4.3.3" fast-glob "^3.2.11" -vite@^4.3.5: +vite@^4.4.9: version "4.4.9" resolved "https://registry.yarnpkg.com/vite/-/vite-4.4.9.tgz#1402423f1a2f8d66fd8d15e351127c7236d29d3d" integrity sha512-2mbUn2LlUmNASWwSCNSJ/EG2HuSRTnVNaydp6vMCm5VIqJsjMfbIWtbH2kDuwUVW5mMUKKZvGPX/rqeqVvv1XA== @@ -6739,6 +6770,13 @@ vue-json-pretty@^2.2.4: resolved "https://registry.yarnpkg.com/vue-json-pretty/-/vue-json-pretty-2.2.4.tgz#4c82fa78aeb987460c727c3b31e45a58f58d9c95" integrity sha512-JX80b3QDrspcH43C53CdtYeq/froApQGSV5y43bEMWFj2LGOxB96aH1VmvrFA21nD1WTP6nwfFMQqGXuS4jyFQ== +vue-json-viewer@3: + version "3.0.4" + resolved "https://registry.yarnpkg.com/vue-json-viewer/-/vue-json-viewer-3.0.4.tgz#c1d65515e57d4036defbbc18fa942d7fd5fb9a8b" + integrity sha512-pnC080rTub6YjccthVSNQod2z9Sl5IUUq46srXtn6rxwhW8QM4rlYn+CTSLFKXWfw+N3xv77Cioxw7B4XUKIbQ== + dependencies: + clipboard "^2.0.4" + vue-prism-component@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/vue-prism-component/-/vue-prism-component-2.0.0.tgz#eec89c5fe1ea3d8b55b8721d823b29d8b73b2b6d" @@ -6773,6 +6811,13 @@ vue3-apexcharts@^1.4.1: resolved "https://registry.yarnpkg.com/vue3-apexcharts/-/vue3-apexcharts-1.4.4.tgz#3fd5f97a79dd323d37c996a44617bb2ec9978152" integrity sha512-TH89uZrxGjaDvkaYAISvj8+k6Bf1rUKFillc8oJirs5XZEPiwM1ELKZQ786wz0rfPqkSHHny2lqqUCK7Rw+LcQ== +vue3-json-viewer@^2.2.2: + version "2.2.2" + resolved "https://registry.yarnpkg.com/vue3-json-viewer/-/vue3-json-viewer-2.2.2.tgz#43a512f378c602bb6b7f2a72adeaf7d15b443885" + integrity sha512-56l3XDGggnpwEqZieXsSMhNT4NhtO6d7zuSAxHo4i0UVxymyY2jRb7UMQOU1ztChKALZCAzX7DlgrsnEhxu77A== + dependencies: + clipboard "^2.0.10" + vue3-perfect-scrollbar@^1.6.1: version "1.6.1" resolved "https://registry.yarnpkg.com/vue3-perfect-scrollbar/-/vue3-perfect-scrollbar-1.6.1.tgz#296e0e0c61a8f6278184f5b09bb45d137af92327"