Skip to content

Commit

Permalink
Merge pull request ymm-tech#33 from littlee/master
Browse files Browse the repository at this point in the history
fix:  修复模板字符串编译时 占位符编译数字 0 值问题
  • Loading branch information
mingyuanwei authored Nov 7, 2019
2 parents 373be4e + f9c724c commit d93c81b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/extend/client/mixin.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import filters from './filters'

// steal from 'ramda'
function defaultTo(d, v) {
return v == null || v !== v ? d : v;
}

const mixin = {
props: [],
data: function () {
Expand Down Expand Up @@ -84,10 +89,10 @@ const mixin = {
if (!isValue) {
if (/^\$scope\./.test(val)) {
// 由父节点传入数据 如列表容器
val = (this.scope && baseGet(this.scope, val)) || ''
val = this.scope && defaultTo('', baseGet(this.scope, val))
} else {
// 由数据总线获取数据
val = this.dataHubGet && this.dataHubGet(val) || ''
val = this.dataHubGet && defaultTo('', this.dataHubGet(val))
}
}
// 过滤器
Expand Down

0 comments on commit d93c81b

Please sign in to comment.