Skip to content

Commit

Permalink
fix: 适配Array取值 #22
Browse files Browse the repository at this point in the history
  • Loading branch information
Panaru0430 authored Oct 30, 2019
1 parent ef0e47c commit 2198461
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/extend/client/mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ const mixin = {
return text || this.$options.props[prop]['default']

function baseGet(target = {}, path = '') {
path = String(path).trim().replace(/^\$scope\./, '')
path = String(path).trim()
.replace(/^\$scope\./, '')
.replace(/\[(\d+)\]/g, (m, p) => `.${p}`) // 适配Array取值 https://github.com/ymm-tech/gods-pen/issues/22
var val
try {
val = path.split('.').reduce((a, b) => a && a[b], target)
Expand Down

0 comments on commit 2198461

Please sign in to comment.