feat: support delimiters option for runtime compilation

close #1679
This commit is contained in:
Evan You 2020-07-22 21:29:59 -04:00
parent 7edfdf7e23
commit ba17c871d8
3 changed files with 12 additions and 3 deletions

View File

@ -87,10 +87,15 @@ export function baseParse(
function createParserContext( function createParserContext(
content: string, content: string,
options: ParserOptions rawOptions: ParserOptions
): ParserContext { ): ParserContext {
const options = extend({}, defaultParserOptions)
for (const key in rawOptions) {
// @ts-ignore
options[key] = rawOptions[key] || defaultParserOptions[key]
}
return { return {
options: extend({}, defaultParserOptions, options), options,
column: 1, column: 1,
line: 1, line: 1,
offset: 0, offset: 0,

View File

@ -607,7 +607,8 @@ function finishComponentSetup(
startMeasure(instance, `compile`) startMeasure(instance, `compile`)
} }
Component.render = compile(Component.template, { Component.render = compile(Component.template, {
isCustomElement: instance.appContext.config.isCustomElement || NO isCustomElement: instance.appContext.config.isCustomElement
// delimiters: Component.delimiters
}) })
if (__DEV__) { if (__DEV__) {
endMeasure(instance, `compile`) endMeasure(instance, `compile`)

View File

@ -321,6 +321,9 @@ interface LegacyOptions<
renderTracked?: DebuggerHook renderTracked?: DebuggerHook
renderTriggered?: DebuggerHook renderTriggered?: DebuggerHook
errorCaptured?: ErrorCapturedHook errorCaptured?: ErrorCapturedHook
// runtime compile only
delimiters?: [string, string]
} }
export type OptionTypesKeys = 'P' | 'B' | 'D' | 'C' | 'M' export type OptionTypesKeys = 'P' | 'B' | 'D' | 'C' | 'M'