File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ export function initCustomFormatter() {
24
24
// custom formatter for Chrome
25
25
// https://www.mattzeunert.com/2016/02/19/custom-chrome-devtools-object-formatters.html
26
26
const formatter = {
27
+ __vue_custom_formatter : true ,
27
28
header ( obj : unknown ) {
28
29
// TODO also format ComponentPublicInstance & ctx.slots/attrs in setup
29
30
if ( ! isObject ( obj ) ) {
Original file line number Diff line number Diff line change @@ -129,7 +129,13 @@ onMounted(() => {
129
129
:preview-options =" {
130
130
customCode: {
131
131
importCode: `import { initCustomFormatter } from 'vue'`,
132
- useCode: `initCustomFormatter()`,
132
+ useCode: `if (window.devtoolsFormatters) {
133
+ const index = window.devtoolsFormatters.findIndex((v) => v.__vue_custom_formatter)
134
+ window.devtoolsFormatters.splice(index, 1)
135
+ initCustomFormatter()
136
+ } else {
137
+ initCustomFormatter()
138
+ }`,
133
139
},
134
140
}"
135
141
/>
You can’t perform that action at this time.
0 commit comments