mirror of https://github.com/vuejs/core.git
parent
de174e1aa7
commit
23cd61423c
|
@ -24,6 +24,7 @@ export function initCustomFormatter() {
|
|||
// custom formatter for Chrome
|
||||
// https://www.mattzeunert.com/2016/02/19/custom-chrome-devtools-object-formatters.html
|
||||
const formatter = {
|
||||
__vue_custom_formatter: true,
|
||||
header(obj: unknown) {
|
||||
// TODO also format ComponentPublicInstance & ctx.slots/attrs in setup
|
||||
if (!isObject(obj)) {
|
||||
|
|
|
@ -129,7 +129,13 @@ onMounted(() => {
|
|||
:preview-options="{
|
||||
customCode: {
|
||||
importCode: `import { initCustomFormatter } from 'vue'`,
|
||||
useCode: `initCustomFormatter()`,
|
||||
useCode: `if (window.devtoolsFormatters) {
|
||||
const index = window.devtoolsFormatters.findIndex((v) => v.__vue_custom_formatter)
|
||||
window.devtoolsFormatters.splice(index, 1)
|
||||
initCustomFormatter()
|
||||
} else {
|
||||
initCustomFormatter()
|
||||
}`,
|
||||
},
|
||||
}"
|
||||
/>
|
||||
|
|
Loading…
Reference in New Issue