0

I got this object:

Object {_supports_ajax: "1", _supports_bundle: "1", css_classes: Array[2], id:     "_data_afbeelding", type: "image"…}
_supports_ajax: "1"
_supports_bundle: "1"
_supports_repeatable: ""
admin_column_filter: ""
admin_column_sortable: ""
after: ""
after_id: ""
ajax: ""
args: Object
    preview_size : Array[2]
        0: 200
        1: 200
        length: 2
        __proto__: Array[0]
    __proto__: Object
css_classes: Array[2]
data_attributes: Array[0]
default_value: ""
description: "Just a little description"
explanation: "This is just a explanation explaining the field above!"
id: "_data_afbeelding"
in_bundle: ""
label: "Afbeelding"
limit: null
meta_type: "post"
name: "afbeelding"
options: Array[0]
parent: "data"
pre: ""
pre_id: ""
repeatable: ""
required: ""
show_admin_column: ""
type: "image"
underscore: "1"
__proto__: Object
}

When I log args (console.log(Object.args)), then I just get an object with preview_size in it. But when I log Object.args.preview_size I get undefined.

Really strange I think, or am I doing something wrong?

4

1 回答 1

2

preview_size和之间有一个空格:,所以你需要这样做:

console.log(Object.args["preview_size "])

我建议您找到创建对象的代码,并修复导致它在那里添加空间的任何问题。我怀疑这是设计使然。

于 2013-10-26T00:27:37.743 回答