feat(config): support configuring runtime compiler via app.config.compilerOptions

- `config.isCustomElement` is deprecated - use `app.config.compilerOptions.isCustomElement` instead.
This commit is contained in:
Evan You
2021-04-26 11:46:29 -04:00
parent b047a0864c
commit 091e6d67bf
4 changed files with 85 additions and 18 deletions

View File

@@ -14,6 +14,7 @@ export const compilerOptions: CompilerOptions = reactive({
inline: false,
ssrCssVars: `{ color }`,
compatConfig: { MODE: 3 },
whitespace: 'condense',
bindingMetadata: {
TestComponent: BindingTypes.SETUP_CONST,
setupRef: BindingTypes.SETUP_REF,
@@ -83,6 +84,32 @@ const App = {
h('label', { for: 'mode-function' }, 'function')
]),
// whitespace handling
h('li', { id: 'whitespace' }, [
h('span', { class: 'label' }, 'whitespace: '),
h('input', {
type: 'radio',
id: 'whitespace-condense',
name: 'whitespace',
checked: compilerOptions.whitespace === 'condense',
onChange() {
compilerOptions.whitespace = 'condense'
}
}),
h('label', { for: 'whitespace-condense' }, 'condense'),
' ',
h('input', {
type: 'radio',
id: 'whitespace-preserve',
name: 'whitespace',
checked: compilerOptions.whitespace === 'preserve',
onChange() {
compilerOptions.whitespace = 'preserve'
}
}),
h('label', { for: 'whitespace-preserve' }, 'preserve')
]),
// SSR
h('li', [
h('input', {