Skip to content

EF/UIView 在查找model值的时候有个隐含的bug #44

Description

@acelan86
      function getProperty(target, path) {
            var value = target;
            for (var i = 0; i < path.length; i++) {
                value = value[path[i]];
            }

            return value;
        }

ef/UIView这块代码有点隐藏的bug

   getProperty({}, ['a', 'b']); //会报错,因为obj.a === undefined

因为模板中怎么写程序是没法预知的,所以,这里的查找放到try里面更好些

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions