0
我想要做一些類似this jsfiddle example的事情,我需要在左面板屬性中添加一些自定義屬性。下面我試圖使類似,但我不能拖動字段如何將自定義屬性添加到AlloyUI表單生成器?
YUI().use('aui-form-builder',function (Y) {
Y.MyFormCustom = Y.Component.create({ NAME: '形式節點',
ATTRS: {
type: {
value: 'custom'
},
customAttr: {
validator: Y.Lang.isString,
value: 'A Custom default'
}
},
EXTENDS: Y.FormBuilderFieldBase,
prototype: {
getPropertyModel: function() {
var instance = this;
var model = Y.FormBuilderFieldBase.superclass.getPropertyModel.apply(instance, arguments);
model.push({
attributeName: 'customAttr',
name: 'Custom Attribute'
});
return model;
}
}
});
Y.FormBuilder.types['custom'] = Y.MyFormCustom;
var availableFields = [
{
iconClass: 'form-builder-field-icon-button',
label: 'Button',
type: 'custom'
}
];
myform= new Y.FormBuilder({
availableFields: availableFields,
boundingBox: '#myHolder'
}).render();
我不「知道爲什麼形式沒有出現。任何幫助將不勝感激。
它必須擴展您的自定義元素繼承的類。 在上面的代碼中,如果** EXTENDS:Y.FormBuilderFieldBase **,則在** availableFields中** _type_應該是一個輸入類型字段元素 – geo007us