Javascript js-如何在计算出的可观察属性中获取可观察属性的值?

Javascript js-如何在计算出的可观察属性中获取可观察属性的值?,javascript,knockout.js,Javascript,Knockout.js,我有以下Knockout.js对象: var viewModel = { description : ko.observable(""), Name : ko.observable(""), productid : ko.observable(""), productmodel : ko.observable(""), productnumber : ko.observable(""), text_relevance : ko.observable

我有以下Knockout.js对象:

var viewModel = {
    description : ko.observable(""),
    Name : ko.observable(""),
    productid : ko.observable(""),
    productmodel : ko.observable(""),
    productnumber : ko.observable(""),
    text_relevance : ko.observable(""),
    mydunamicfield : ko.computed(function() {
        return "bq=(and " +
            ((this.description == "") ? "" : ("description:" + this.description + " ")) +
            ")";
    } , this)
};
但是
mydunamicfield
属性没有生成正确的连接结果。如果我尝试在另一个函数中引用
this.description()
,则在加载页面时会看到以下错误消息:

Property 'description' of object [object Window] is not a function

这种情况下有什么问题?

首先,如果要获取其值,必须将
this.description
引用为
this.description()

其次,尝试将
computed
字段放在
viewModel
之外(因为
'this'
viewModel
本身在创建
computed
可观察时未定义)

有关工作示例,请参见