Skip to content

Commit

Permalink
fix: properly treat falsy values in context (#685)
Browse files Browse the repository at this point in the history
Co-authored-by: Alexander <[email protected]>
  • Loading branch information
AlexanderBelokon and Alexander authored Jan 7, 2021
1 parent 68a52ef commit 228f7e0
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 228f7e0

Please sign in to comment.