Nuxt/test/fixtures/basic/plugins/inject.js

17 lines
335 B
JavaScript
Raw Normal View History

export default ({ route, params }, inject) => {
const { injectValue } = route.query
if (typeof injectValue === 'undefined') {
return
}
const key = 'injectedProperty'
const map = {
undefined,
'null': null,
'false': false,
'0': 0,
'empty': ''
}
const value = map[injectValue]
inject(key, value)
}