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 = { const App = {
setup() { setup() {
return () => [ return () => {
const usePrefix =
compilerOptions.prefixIdentifiers || compilerOptions.mode === 'module'
return [
h('h1', `Vue 3 Template Explorer`), h('h1', `Vue 3 Template Explorer`),
h( h(
'a', 'a',
@ -51,9 +54,7 @@ const App = {
type: 'checkbox', type: 'checkbox',
id: 'prefix', id: 'prefix',
disabled: compilerOptions.mode === 'module', disabled: compilerOptions.mode === 'module',
checked: checked: usePrefix,
compilerOptions.prefixIdentifiers ||
compilerOptions.mode === 'module',
onChange(e: Event) { onChange(e: Event) {
compilerOptions.prefixIdentifiers = compilerOptions.prefixIdentifiers =
(<HTMLInputElement>e.target).checked || (<HTMLInputElement>e.target).checked ||
@ -77,17 +78,19 @@ const App = {
h('input', { h('input', {
type: 'checkbox', type: 'checkbox',
id: 'cache', id: 'cache',
checked: checked: usePrefix && compilerOptions.cacheHandlers,
compilerOptions.cacheHandlers && compilerOptions.prefixIdentifiers, disabled: !usePrefix,
disabled: !compilerOptions.prefixIdentifiers,
onChange(e: Event) { onChange(e: Event) {
compilerOptions.cacheHandlers = (<HTMLInputElement>e.target).checked compilerOptions.cacheHandlers = (<HTMLInputElement>(
e.target
)).checked
} }
}), }),
h('label', { for: 'cache' }, 'cacheHandlers') h('label', { for: 'cache' }, 'cacheHandlers')
]) ])
] ]
} }
}
} }
export function initOptions() { export function initOptions() {