workflow(template-explorer): fix cacheHandlers disabled state

This commit is contained in:
Evan You 2019-12-10 12:46:38 -05:00
parent c8c5b16ef7
commit 03301b264e

View File

@ -10,7 +10,10 @@ export const compilerOptions: CompilerOptions = reactive({
const App = {
setup() {
return () => [
return () => {
const usePrefix =
compilerOptions.prefixIdentifiers || compilerOptions.mode === 'module'
return [
h('h1', `Vue 3 Template Explorer`),
h(
'a',
@ -51,9 +54,7 @@ const App = {
type: 'checkbox',
id: 'prefix',
disabled: compilerOptions.mode === 'module',
checked:
compilerOptions.prefixIdentifiers ||
compilerOptions.mode === 'module',
checked: usePrefix,
onChange(e: Event) {
compilerOptions.prefixIdentifiers =
(<HTMLInputElement>e.target).checked ||
@ -77,11 +78,12 @@ const App = {
h('input', {
type: 'checkbox',
id: 'cache',
checked:
compilerOptions.cacheHandlers && compilerOptions.prefixIdentifiers,
disabled: !compilerOptions.prefixIdentifiers,
checked: usePrefix && compilerOptions.cacheHandlers,
disabled: !usePrefix,
onChange(e: Event) {
compilerOptions.cacheHandlers = (<HTMLInputElement>e.target).checked
compilerOptions.cacheHandlers = (<HTMLInputElement>(
e.target
)).checked
}
}),
h('label', { for: 'cache' }, 'cacheHandlers')
@ -89,6 +91,7 @@ const App = {
]
}
}
}
export function initOptions() {
createApp().mount(App, document.getElementById('header')!)