workflow(template-explorer): fix cacheHandlers disabled state
This commit is contained in:
parent
c8c5b16ef7
commit
03301b264e
@ -10,83 +10,86 @@ export const compilerOptions: CompilerOptions = reactive({
|
|||||||
|
|
||||||
const App = {
|
const App = {
|
||||||
setup() {
|
setup() {
|
||||||
return () => [
|
return () => {
|
||||||
h('h1', `Vue 3 Template Explorer`),
|
const usePrefix =
|
||||||
h(
|
compilerOptions.prefixIdentifiers || compilerOptions.mode === 'module'
|
||||||
'a',
|
return [
|
||||||
{
|
h('h1', `Vue 3 Template Explorer`),
|
||||||
href: `https://github.com/vuejs/vue-next/tree/${__COMMIT__}`,
|
h(
|
||||||
target: `_blank`
|
'a',
|
||||||
},
|
{
|
||||||
`@${__COMMIT__}`
|
href: `https://github.com/vuejs/vue-next/tree/${__COMMIT__}`,
|
||||||
),
|
target: `_blank`
|
||||||
h('div', { id: 'options' }, [
|
},
|
||||||
// mode selection
|
`@${__COMMIT__}`
|
||||||
h('span', { class: 'options-group' }, [
|
),
|
||||||
h('span', { class: 'label' }, 'Mode:'),
|
h('div', { id: 'options' }, [
|
||||||
|
// mode selection
|
||||||
|
h('span', { class: 'options-group' }, [
|
||||||
|
h('span', { class: 'label' }, 'Mode:'),
|
||||||
|
h('input', {
|
||||||
|
type: 'radio',
|
||||||
|
id: 'mode-module',
|
||||||
|
name: 'mode',
|
||||||
|
checked: compilerOptions.mode === 'module',
|
||||||
|
onChange() {
|
||||||
|
compilerOptions.mode = 'module'
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
h('label', { for: 'mode-module' }, 'module'),
|
||||||
|
h('input', {
|
||||||
|
type: 'radio',
|
||||||
|
id: 'mode-function',
|
||||||
|
name: 'mode',
|
||||||
|
checked: compilerOptions.mode === 'function',
|
||||||
|
onChange() {
|
||||||
|
compilerOptions.mode = 'function'
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
h('label', { for: 'mode-function' }, 'function')
|
||||||
|
]),
|
||||||
|
|
||||||
|
// toggle prefixIdentifiers
|
||||||
h('input', {
|
h('input', {
|
||||||
type: 'radio',
|
type: 'checkbox',
|
||||||
id: 'mode-module',
|
id: 'prefix',
|
||||||
name: 'mode',
|
disabled: compilerOptions.mode === 'module',
|
||||||
checked: compilerOptions.mode === 'module',
|
checked: usePrefix,
|
||||||
onChange() {
|
onChange(e: Event) {
|
||||||
compilerOptions.mode = 'module'
|
compilerOptions.prefixIdentifiers =
|
||||||
|
(<HTMLInputElement>e.target).checked ||
|
||||||
|
compilerOptions.mode === 'module'
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
h('label', { for: 'mode-module' }, 'module'),
|
h('label', { for: 'prefix' }, 'prefixIdentifiers'),
|
||||||
|
|
||||||
|
// toggle hoistStatic
|
||||||
h('input', {
|
h('input', {
|
||||||
type: 'radio',
|
type: 'checkbox',
|
||||||
id: 'mode-function',
|
id: 'hoist',
|
||||||
name: 'mode',
|
checked: compilerOptions.hoistStatic,
|
||||||
checked: compilerOptions.mode === 'function',
|
onChange(e: Event) {
|
||||||
onChange() {
|
compilerOptions.hoistStatic = (<HTMLInputElement>e.target).checked
|
||||||
compilerOptions.mode = 'function'
|
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
h('label', { for: 'mode-function' }, 'function')
|
h('label', { for: 'hoist' }, 'hoistStatic'),
|
||||||
]),
|
|
||||||
|
|
||||||
// toggle prefixIdentifiers
|
// toggle cacheHandlers
|
||||||
h('input', {
|
h('input', {
|
||||||
type: 'checkbox',
|
type: 'checkbox',
|
||||||
id: 'prefix',
|
id: 'cache',
|
||||||
disabled: compilerOptions.mode === 'module',
|
checked: usePrefix && compilerOptions.cacheHandlers,
|
||||||
checked:
|
disabled: !usePrefix,
|
||||||
compilerOptions.prefixIdentifiers ||
|
onChange(e: Event) {
|
||||||
compilerOptions.mode === 'module',
|
compilerOptions.cacheHandlers = (<HTMLInputElement>(
|
||||||
onChange(e: Event) {
|
e.target
|
||||||
compilerOptions.prefixIdentifiers =
|
)).checked
|
||||||
(<HTMLInputElement>e.target).checked ||
|
}
|
||||||
compilerOptions.mode === 'module'
|
}),
|
||||||
}
|
h('label', { for: 'cache' }, 'cacheHandlers')
|
||||||
}),
|
])
|
||||||
h('label', { for: 'prefix' }, 'prefixIdentifiers'),
|
]
|
||||||
|
}
|
||||||
// toggle hoistStatic
|
|
||||||
h('input', {
|
|
||||||
type: 'checkbox',
|
|
||||||
id: 'hoist',
|
|
||||||
checked: compilerOptions.hoistStatic,
|
|
||||||
onChange(e: Event) {
|
|
||||||
compilerOptions.hoistStatic = (<HTMLInputElement>e.target).checked
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
h('label', { for: 'hoist' }, 'hoistStatic'),
|
|
||||||
|
|
||||||
// toggle cacheHandlers
|
|
||||||
h('input', {
|
|
||||||
type: 'checkbox',
|
|
||||||
id: 'cache',
|
|
||||||
checked:
|
|
||||||
compilerOptions.cacheHandlers && compilerOptions.prefixIdentifiers,
|
|
||||||
disabled: !compilerOptions.prefixIdentifiers,
|
|
||||||
onChange(e: Event) {
|
|
||||||
compilerOptions.cacheHandlers = (<HTMLInputElement>e.target).checked
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
h('label', { for: 'cache' }, 'cacheHandlers')
|
|
||||||
])
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user