fix(runtime-dom): v-cloak should be removed after compile on the root element (#893)

fix #890
This commit is contained in:
likui 2020-04-01 06:13:59 +08:00 committed by GitHub
parent f924bd68bc
commit 0ed147d336
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

@ -0,0 +1,10 @@
import { createApp } from '@vue/runtime-dom'
describe('vCloak', () => {
test('should be removed after compile', () => {
const root = document.createElement('div')
root.setAttribute('v-cloak', '')
createApp({}).mount(root)
expect(root.hasAttribute('v-cloak')).toBe(false)
})
})

View File

@ -63,7 +63,9 @@ export const createApp = ((...args) => {
}
// clear content before mounting
container.innerHTML = ''
return mount(container)
const proxy = mount(container)
container.removeAttribute('v-cloak')
return proxy
}
return app