1
1
<script setup lang="ts">
2
2
import { VueButton , VueDropdown , VueDropdownButton , VueIcon , VTooltip as vTooltip } from ' @vue/devtools-ui'
3
+ import { getRawValue } from ' @vue/devtools-kit'
3
4
import type { InspectorState , InspectorStateEditorPayload } from ' @vue/devtools-kit'
4
5
import type { ButtonProps } from ' @vue/devtools-ui/dist/types/src/components/Button'
5
6
import { useDevToolsBridgeRpc } from ' @vue/devtools-core'
@@ -28,9 +29,8 @@ const { copy, isSupported } = useClipboard()
28
29
29
30
const popupVisible = ref (false )
30
31
31
- const dataType = computed (() => {
32
- return typeof props .data .value
33
- })
32
+ const rawValue = computed (() => getRawValue (props .data .value ).value )
33
+ const dataType = computed (() => typeof rawValue .value )
34
34
35
35
const iconButtonProps = {
36
36
flat: true ,
@@ -77,7 +77,7 @@ function quickEdit(v: unknown, remove: boolean = false) {
77
77
v-tooltip =" {
78
78
content: 'Add new value',
79
79
}" v-bind =" iconButtonProps" :class =" buttonClass" @click.stop ="
80
- $emit('addNewProp', Array.isArray(data.value ) ? 'array' : 'object')"
80
+ $emit('addNewProp', Array.isArray(rawValue ) ? 'array' : 'object')"
81
81
>
82
82
<template #icon >
83
83
<VueIcon icon =" i-material-symbols-add-circle-rounded" />
@@ -87,28 +87,28 @@ function quickEdit(v: unknown, remove: boolean = false) {
87
87
<!-- checkbox, button value only -->
88
88
<VueButton
89
89
v-if =" dataType === 'boolean'" v-bind =" iconButtonProps" :class =" buttonClass"
90
- @click =" quickEdit(!data.value )"
90
+ @click =" quickEdit(!rawValue )"
91
91
>
92
92
<template #icon >
93
- <VueIcon :icon =" data.value ? 'i-material-symbols-check-box-sharp' : 'i-material-symbols-check-box-outline-blank-sharp'" />
93
+ <VueIcon :icon =" rawValue ? 'i-material-symbols-check-box-sharp' : 'i-material-symbols-check-box-outline-blank-sharp'" />
94
94
</template >
95
95
</VueButton >
96
96
<!-- increment/decrement button, numeric value only -->
97
97
<template v-else-if =" dataType === ' number' " >
98
- <VueButton v-bind =" iconButtonProps" :class =" buttonClass" @click =" quickEdit((data.value as number) + 1)" >
98
+ <VueButton v-bind =" iconButtonProps" :class =" buttonClass" @click =" quickEdit((rawValue as number) + 1)" >
99
99
<template #icon >
100
100
<VueIcon icon =" i-carbon-add" />
101
101
</template >
102
102
</VueButton >
103
- <VueButton v-bind =" iconButtonProps" :class =" buttonClass" @click =" quickEdit((data.value as number) - 1)" >
103
+ <VueButton v-bind =" iconButtonProps" :class =" buttonClass" @click =" quickEdit((rawValue as number) - 1)" >
104
104
<template #icon >
105
105
<VueIcon icon =" i-carbon-subtract" />
106
106
</template >
107
107
</VueButton >
108
108
</template >
109
109
</template >
110
110
<!-- delete prop, only appear if depth > 0 -->
111
- <VueButton v-if =" !props.disableEdit && depth > 0" v-bind =" iconButtonProps" :class =" buttonClass" @click =" quickEdit(data.value , true)" >
111
+ <VueButton v-if =" !props.disableEdit && depth > 0" v-bind =" iconButtonProps" :class =" buttonClass" @click =" quickEdit(rawValue , true)" >
112
112
<template #icon >
113
113
<VueIcon icon =" i-material-symbols-delete-rounded" />
114
114
</template >
@@ -128,7 +128,7 @@ function quickEdit(v: unknown, remove: boolean = false) {
128
128
<template #popper >
129
129
<div class =" w160px py5px" >
130
130
<VueDropdownButton
131
- @click =" copy(dataType === 'object' ? JSON.stringify(data.value ) : data.value .toString())"
131
+ @click =" copy(dataType === 'object' ? JSON.stringify(rawValue ) : rawValue .toString())"
132
132
>
133
133
<template #icon >
134
134
<VueIcon icon =" i-material-symbols-copy-all-rounded" class =" mt4px" />
0 commit comments