2016-04-25 3 views
0

REF this jsfiddleRACTIVE)は属性が(GETで返さ

htmlの計算

window.ractive = new Ractive({ 
    el: 'main', 
    template: '<p>a thing called {{thing}}</p>', 
    computed: { thing : function(){return "kablooie"} } 
}); 
$('#result').html(JSON.stringify(ractive.get())) 

ractive.get()ここでの値を返すありません属性「もの」。ドキュメントでは、計算された属性はget()によって返されません。

この意図的な動作またはバグですか?

答えて

1

使用しているエッジRactive(0.8になります)では、計算されマッピングされたプロパティを機能要求としてractive.get()経由でルートgetに追加しました。

意味しており、ractive.get('.')経由のみルートデータオブジェクトを取得することができるように現在の提案のためのthis issueを参照してください:

window.ractive = new Ractive({ 
    el: 'main', 
    data: { foo: 'foo' }, 
    template: '<p>a thing called {{thing}}</p>', 
    computed: { thing : function(){return "kablooie"} } 
}); 

console.log(JSON.stringify(ractive.get())); 
// { foo: 'foo', thing: 'kablooie' } 

console.log(JSON.stringify(ractive.get('.'))); 
// { foo: 'foo' } 
+0

は、マーティをありがとう、そしてRACTIVEためにすべてのあなたの貢献に感謝します。言うまでもなく、「エッジ」文書はまだこの変更を反映していません。 –

関連する問題