fix(runtime-core): support extends template for runtime compiler (#6250)
fix #6249
This commit is contained in:
parent
6624ead663
commit
9875ecd762
@ -12,6 +12,7 @@ import {
|
||||
createApp,
|
||||
computed
|
||||
} from '@vue/runtime-test'
|
||||
import { render as domRender } from 'vue'
|
||||
|
||||
describe('api: options', () => {
|
||||
test('data', async () => {
|
||||
@ -1035,6 +1036,19 @@ describe('api: options', () => {
|
||||
expect(renderToString(h(Comp))).toBe('base,base')
|
||||
})
|
||||
|
||||
test('extends template', () => {
|
||||
const Comp = {
|
||||
extends: {
|
||||
template: `<h1>Foo</h1>`
|
||||
}
|
||||
}
|
||||
|
||||
const root = document.createElement('div') as any
|
||||
domRender(h(Comp), root)
|
||||
expect(root.innerHTML).toBe(`<h1>Foo</h1>`)
|
||||
})
|
||||
|
||||
|
||||
test('options defined in component have higher priority', async () => {
|
||||
const Mixin = {
|
||||
msg1: 'base'
|
||||
|
@ -35,7 +35,8 @@ import {
|
||||
applyOptions,
|
||||
ComponentOptions,
|
||||
ComputedOptions,
|
||||
MethodOptions
|
||||
MethodOptions,
|
||||
resolveMergedOptions
|
||||
} from './componentOptions'
|
||||
import {
|
||||
EmitsOptions,
|
||||
@ -792,7 +793,8 @@ export function finishComponentSetup(
|
||||
(__COMPAT__ &&
|
||||
instance.vnode.props &&
|
||||
instance.vnode.props['inline-template']) ||
|
||||
Component.template
|
||||
Component.template ||
|
||||
resolveMergedOptions(instance).template
|
||||
if (template) {
|
||||
if (__DEV__) {
|
||||
startMeasure(instance, `compile`)
|
||||
|
Loading…
Reference in New Issue
Block a user