如何在Ext js中创建Ext.data.Model时将字段设为String元素列表?
Ext.define('User', {
extend: 'Ext.data.Model',
fields: [
{name: 'name', type: 'string'},
{name: 'age', type: 'int', convert: null},
{name: 'phone', type: 'string'},
{name: 'alive', type: 'boolean', defaultValue: true}
]
});
答案 0 :(得分:1)
只需排除类型:
Ext.define('User', {
extend: 'Ext.data.Model',
fields: [
{name: 'foo'}
]
});
var o = new User({
foo: ['a', 'b', 'c']
});
console.log(o.get('foo'));