dx(runtime-core): add selector in mount warning (#2563)

This commit is contained in:
Cédric Exbrayat 2020-12-05 00:25:13 +01:00 committed by GitHub
parent 5b9b37fc9b
commit dbe22ba356
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -111,7 +111,9 @@ function normalizeContainer(
if (isString(container)) { if (isString(container)) {
const res = document.querySelector(container) const res = document.querySelector(container)
if (__DEV__ && !res) { if (__DEV__ && !res) {
warn(`Failed to mount app: mount target selector returned null.`) warn(
`Failed to mount app: mount target selector "${container}" returned null.`
)
} }
return res return res
} }

View File

@ -205,7 +205,7 @@ describe('compiler + runtime integration', () => {
createApp(App).mount('#not-exist-id') createApp(App).mount('#not-exist-id')
expect( expect(
'[Vue warn]: Failed to mount app: mount target selector returned null.' '[Vue warn]: Failed to mount app: mount target selector "#not-exist-id" returned null.'
).toHaveBeenWarned() ).toHaveBeenWarned()
document.querySelector = origin document.querySelector = origin
}) })