0.12.0 • Published 4 years ago

etadmin-common v0.12.0

Weekly downloads
7
License
MIT
Repository
-
Last release
4 years ago

etadmin-common

Installing

npm:

$ npm install etadmin-common

cdn:

<script src="etadmin.js"></script>
<script src="https://treeast.com/assets/script/etadmin.common.min.js"></script>

Example

note: CommonJS usage

Http

// 1.
return config
// 2. Promise
return new Promise(resolve => {
  resolve(config)
})
// 3. async/await
return (async () => {
  await $$.module.organization.api.list({
    success: data => {
      console.log('...data', data)
    }
  })
  return config
})()
// 各种取数据
// $$.module.organization.api.view({
//   data: { id: id },
//   success: data => {
//     this.value = data
//   }
// })
// .then(data => {
//   $$.log('...data', data)
// })
// .catch(error => {
// $$.log('...error', error)
// })
// .finally(() => {
//   $$.log('....finally')
// })

// 各种关闭方法
// <template #action="{data, close}">
// <Action @click="data.visible = false">关闭</Action>
// <Action @click="close()">关闭</Action>
// <Action @click="onClose()">关闭</Action> <!-- <PageView :visible="visible"> -->
// </template>

Module

// 抽象出 数据、组件、API
const xxx = {
  name: 'xx', // 名称
  data,       // 数据(解构) $ -> 源
  component,  // 组件(解构) $ -> 源
  api,        // API  $ -> 源
  config: {   // 配置 子类继承
    http,       // http
    menu,       // 菜单
    layout,     // 布局
    compine,    // 编译回掉 api, component
  }
}

2.0

每个模块一个对象,对象 $name $data $component $api $config $http $menu +hook
const root = new Module({ name: 'xxx' })

// 父类编译
root.comp()

// 单独编译后挂载
0.12.0

4 years ago

0.10.0

4 years ago

0.11.0

4 years ago

0.8.0

4 years ago

0.7.6

4 years ago

0.7.3

4 years ago

0.7.1

4 years ago

0.7.0

4 years ago

0.6.1

5 years ago

0.6.0

5 years ago