wip: defineContext()
This commit is contained in:
@@ -62,7 +62,7 @@ export type HoistTransform = (
|
||||
) => void
|
||||
|
||||
export interface BindingMetadata {
|
||||
[key: string]: 'data' | 'props' | 'setup' | 'options' | 'component-import'
|
||||
[key: string]: 'data' | 'props' | 'setup' | 'options' | 'setup-raw'
|
||||
}
|
||||
|
||||
interface SharedTransformCodegenOptions {
|
||||
|
||||
@@ -270,9 +270,9 @@ export function resolveComponentType(
|
||||
`${context.helperString(UNREF)}(${tagFromSetup})`
|
||||
: `$setup[${JSON.stringify(tagFromSetup)}]`
|
||||
}
|
||||
const tagFromImport = checkType('component-import')
|
||||
const tagFromImport = checkType('setup-raw')
|
||||
if (tagFromImport) {
|
||||
// imports can be used as-is
|
||||
// raw setup bindings (e.g. imports) can be used as-is
|
||||
return tagFromImport
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +105,11 @@ export function processExpression(
|
||||
// setup inline mode
|
||||
if (type === 'setup') {
|
||||
return `${context.helperString(UNREF)}(${raw})`
|
||||
} else if (type === 'component-import') {
|
||||
} else if (type === 'props') {
|
||||
// use __props which is generated by compileScript so in ts mode
|
||||
// it gets correct type
|
||||
return `__props.${raw}`
|
||||
} else if (type === 'setup-raw') {
|
||||
return raw
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user