能够向对象添加新属性,但无法检索其值

问题描述

我正在创建一个类似于“文件”的对象,并向其添加字符串属性“ restUrl”。

我想做的就是随时上传文件调用“ onPropertyChanged”功能...

我想在此事件上检索restUrl属性。我无法做到

SurveyKo
    .ComponentCollection
    .Instance
    .add({
        name: "FileUploader",title: "FileUploader",questionjsON: {
            type: "file",maxSize: 0 
        },onInit() {
            //Create a new class derived from Survey.ItemValue
            //It hides text,visibleIf and enableIf properties
            //and it adds a new price number property.              
            //Add orderItems properties. It is an array of ordertableitem elements
            SurveyKo
            .Serializer
            .addProperty("FileUploader",{
                name: "restUrl:string",//onGetValue: function (sss) { console.log(sss.titleValue); return sss.titleValue; },default: "/get/callYourapi",category: "general"
            });
        },onLoaded(question) {
            //Create rows and default values on first loading 
            console.log("I am loaded");
        },//Calls on property changed in component/root question
        onPropertyChanged(question,propertyName,newValue) {
          console.log("-------------"); 
                 // ??? I WANT THE CURRENT RestUrl hERE xxxxxxxxxxxxxxxx?????????????????
        },//Calls when a property of ItemValue element is changed.
        onItemValuePropertyChanged(question,options) {
            //If the propertyName of the array is "orderItems"
            console.log("I have value changed");
        }  
    });

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)