コードはWHITESPACE_ONLYオプションで完璧に機能します。しかし、ADVANCEDモードでは、ドット表記法は機能しません。しかし、ブラケット記法はまだ機能します。ここでドット表記を使用して値を取得できません。
{
'title' : 'The title',
'type' : 'SIM',
'description' : 'Build your own description.',
'iconclass' : goog.getCssName('img-icons-bs')
}
コードです:ここで
はJSONオブジェクトであるconsole.log('this.obj_ = ' + JSON.stringify(this.obj_));
console.log('this.obj_.iconclass = ' + this.obj_.iconclass);
console.log('this.obj_[iconclass] = ' + this.obj_['iconclass']);
出力:
> this.obj_ = {"title":"The title","type":"SIM","description":"Build
> your own description.","iconclass":"img-icons-r"}
> this.obj_.iconclass = undefined
> this.obj_[iconclass] = img-icons-r
問題がありますか?
もう一度お試しください。そして、あなたはほとんどのタイプミスをチェックしました。たとえ '.iconClass'のような大文字と小文字の違いがあったとしても? – SmokeyPHP
@SmokeyPHP、はい、私はそれをチェックしました。 – Vadim