From 21984614461f9dd1813e5448a11d488236e0c688 Mon Sep 17 00:00:00 2001 From: panaru <1010605156@qq.com> Date: Wed, 30 Oct 2019 19:41:10 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=80=82=E9=85=8DArray=E5=8F=96?= =?UTF-8?q?=E5=80=BC=20https://github.com/ymm-tech/gods-pen/issues/22?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/extend/client/mixin.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/extend/client/mixin.js b/src/extend/client/mixin.js index f467a3e..2251ed4 100644 --- a/src/extend/client/mixin.js +++ b/src/extend/client/mixin.js @@ -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)