0.0.3 • Published 2 years ago

model-libs v0.0.3

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

How to use

const ModelTab  =  Model.define('ModelTab', {
  id: {
    type: Number,
    field: 'id',
    default: 0,
  },
  image1: {
    // key和后端接口返回的key一致,就不需要写对应的field字段
    type: String,
    field: 'image',
    default: '',
  },
  name: {
    type: String,
    field: 'name',
    default: '',
  },
  noticeCategoryVOS: {
    type: Array,
    field: 'noticeCategoryVOS',
    default: [],
  },
  type: {
    type: Number,
    field: 'type',
    default: 0,
  },
})

await axios.get('/user').then((res)=>{
  let mapping  = ModelTab.fromData(res.data)
  console.log('---:',mapping)
})