Skip to content

Commit

Permalink
fix: properly treat falsy values in context
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander committed Dec 18, 2020
1 parent c50468c commit 2ebe282
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions packages/content/templates/nuxt-content.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,11 @@ function propsToData (props, doc) {
const { attribute } = info.find(info.html, key)

if (key === 'v-bind') {
let val = doc[value]
if (!val) {
val = eval(`(${value})`)
}
const val = value in doc ? doc[value] : eval(`(${value})`)
obj = Object.assign(obj, val)
} else if (key.indexOf(':') === 0 || key.indexOf('v-bind:') === 0) {
key = key.replace('v-bind:', '').replace(':', '')
if (doc[value]) {
obj[key] = doc[value]
} else {
obj[key] = eval(`(${value})`)
}
obj[key] = value in doc ? doc[value] : eval(`(${value})`)
} else if (Array.isArray(value)) {
obj[attribute] = value.join(' ')
} else {
Expand Down

0 comments on commit 2ebe282

Please sign in to comment.