Android Nativescript RadDataForm:JS:Binding:Binding设置RadDataForm的属性源时出错<;myDataForm>;
我试图使用nativescript RadformData,但当我绑定数据模型时,我总是会遇到此错误“设置RadDataForm的属性源时JS:Binding:Binding错误”,当我导航到RadformData页面时,我通过改变包中的数据格式版本做了很多尝试。json我也清理了平台,但运气不好,请给出建议 这是我的代码: 事件页面.xmlAndroid Nativescript RadDataForm:JS:Binding:Binding设置RadDataForm的属性源时出错<;myDataForm>;,android,nativescript,Android,Nativescript,我试图使用nativescript RadformData,但当我绑定数据模型时,我总是会遇到此错误“设置RadDataForm的属性源时JS:Binding:Binding错误”,当我导航到RadformData页面时,我通过改变包中的数据格式版本做了很多尝试。json我也清理了平台,但运气不好,请给出建议 这是我的代码: 事件页面.xml <Page loaded="onPageLoaded" xmlns:df="nativescript-ui-dataform" xmlns="ht
<Page loaded="onPageLoaded" xmlns:df="nativescript-ui-dataform"
xmlns="http://www.nativescript.org/tns.xsd">
<ActionBar title="Add Event" />
<df:RadDataForm id="myDataForm" source="{{ calEvent }}">
<df:RadDataForm.properties>
<df:EntityProperty name="title" hintText="Title" index="0">
<df:EntityProperty.editor>
<df:PropertyEditor type="Text"></df:PropertyEditor>
</df:EntityProperty.editor>
</df:EntityProperty>
<df:EntityProperty name="description" hintText="Description" index="1">
<df:EntityProperty.editor>
<df:PropertyEditor type="Text"></df:PropertyEditor>
</df:EntityProperty.editor>
</df:EntityProperty>
<df:EntityProperty name="stringDate" hintText="select date" index="2">
<df:EntityProperty.editor>
<df:PropertyEditor type="DatePicker"></df:PropertyEditor>
</df:EntityProperty.editor>
</df:EntityProperty>
<df:EntityProperty name="dateDate" hintText="select date" index="3">
<df:EntityProperty.editor>
<df:PropertyEditor type="DatePicker"></df:PropertyEditor>
</df:EntityProperty.editor>
</df:EntityProperty>
<df:EntityProperty name="timestampDate" hintText="select date" index="4" converter="{{ timestampConverter }}">
<df:EntityProperty.editor>
<df:PropertyEditor type="DatePicker"></df:PropertyEditor>
</df:EntityProperty.editor>
</df:EntityProperty>
<df:EntityProperty name="stringTime" hintText="select time" index="5">
<df:EntityProperty.editor>
<df:PropertyEditor type="TimePicker"></df:PropertyEditor>
</df:EntityProperty.editor>
</df:EntityProperty>
<df:EntityProperty name="dateTime" hintText="select time" index="6">
<df:EntityProperty.editor>
<df:PropertyEditor type="TimePicker"></df:PropertyEditor>
</df:EntityProperty.editor>
</df:EntityProperty>
<df:EntityProperty name="timestampTime" hintText="select time" index="7" converter="{{ timestampConverter }}">
<df:EntityProperty.editor>
<df:PropertyEditor type="TimePicker"></df:PropertyEditor>
</df:EntityProperty.editor>
</df:EntityProperty>
</df:RadDataForm.properties>
</df:RadDataForm>
</Page>
如果我在操场上使用相同的代码,我看不到任何错误。请仔细检查并可能分享一个游乐场示例,在那里可以复制该问题。我也很好,尝试创建一个游乐场或更新此游乐场。是的,在我清理平台后,它工作正常。谢谢:-)如果我在游乐场使用相同的代码,我看不到任何错误。请仔细检查并可能分享一个游乐场示例,在那里可以复制该问题。我也很好,尝试创建一个游乐场或更新此游乐场。是的,在我清洁平台后,它工作正常。谢谢大家:-)
import { EventViewModel } from "./event-view-model";
import { Page } from "tns-core-modules/ui/page/page";
export function onPageLoaded(args) {
const page = <Page>args.object;
var eventModel = new EventViewModel();
page.bindingContext = eventModel;
}
import { Observable } from "tns-core-modules/data/observable";
import { PropertyConverter } from "nativescript-ui-dataform";
export class EventViewModel extends Observable {
private _event: CalEvent;
constructor() {
super();
this.set("timestampConverter", new TimestampConverter());
this.onSetDefaults();
}
public onSetDefaults() {
const stringDate = "1999-08-11";
const dateDate = new Date();
const timestampDate = (new Date()).getTime();
const stringTime = "11:04";
const dateTime = new Date(1);
const timestampTime = (new Date()).getTime();
this._event = new CalEvent("First Event","Desc",stringDate, dateDate, timestampDate, stringTime, dateTime, timestampTime);
}
get calEvent(): CalEvent{
return this._event;
}
}
export class TimestampConverter implements PropertyConverter {
public convertFrom(timestamp: number) {
const date = timestamp ? new Date(timestamp) : null;
const result = date === null ? null : date.toJSON();
return result;
}
public convertTo(dateString: string) {
const date = new Date(dateString);
const result = date ? date.getTime() : 0;
return result;
}
}
export class CalEvent {
public title: string;
public description: string;
public stringDate: string;
public dateDate: Date;
public timestampDate: number;
public stringTime: string;
public dateTime: Date;
public timestampTime: number;
constructor(title: string, desc: string, stringDate: string, dateDate: Date, timestampDate: number, stringTime: string, dateTime: Date, timestampTime: number) {
this.title = title;
this.description = desc;
this.stringDate = stringDate;
this.dateDate = dateDate;
this.timestampDate = timestampDate;
this.stringTime = stringTime;
this.dateTime = dateTime;
this.timestampTime = timestampTime;
}
}