feat(sfc): wip scopeId compiler support

This commit is contained in:
Evan You
2019-12-16 12:11:51 -05:00
parent b2c2d0590e
commit 51980afca2
8 changed files with 107 additions and 22 deletions

View File

@@ -5,7 +5,8 @@ export const compilerOptions: CompilerOptions = reactive({
mode: 'module',
prefixIdentifiers: false,
hoistStatic: false,
cacheHandlers: false
cacheHandlers: false,
scopeId: null
})
const App = {
@@ -86,7 +87,24 @@ const App = {
)).checked
}
}),
h('label', { for: 'cache' }, 'cacheHandlers')
h('label', { for: 'cache' }, 'cacheHandlers'),
// toggle scopeId
h('input', {
type: 'checkbox',
id: 'scope-id',
disabled: compilerOptions.mode !== 'module',
checked:
compilerOptions.mode === 'module' && compilerOptions.scopeId,
onChange(e: Event) {
compilerOptions.scopeId =
compilerOptions.mode === 'module' &&
(<HTMLInputElement>e.target).checked
? 'scope-id'
: null
}
}),
h('label', { for: 'scope-id' }, 'scopeId')
])
]
}