Skip to content

mybricks/comlib-pc-normal

Repository files navigation

Mybricks-PC端通用组件库

✨ 特性

  • 所见即所得的开发体验
  • 通用无代码,通过图形化编排的方式可实现复杂的功能
  • 方便且强大的即时调试能力

✨ 依赖的 Env 方法

// 引入连接器,仓库地址 https://github.com/mybricks/plugin-connector-http
import { call as callConnectorHttp } from '@mybricks/plugin-connector-http'

const env = {
  i18n (text: string) {
    // 多语言定制
    return text
  },
  callConnector (connector, params) {
    //调用连接器
    if (connector.type === 'http') {
      //服务接口类型
      return callConnectorHttp({ script: connector.script }, params)
    } else {
      return Promise.reject('错误的连接器类型.')
    }
  },
  vars: {
    getQuery: () => {
      // 返回页面路由参数
      return {}
    },
    get hasPermission() {
      return ({ key }) => {
        // TOD 操作权限校验
        return true
      })
    },
    get getRouter () {
      return () => {
        reload: () => {
          // TOD 刷新页面
        },
        redirect: ({ url }: { url: string }) => {
          // TOD 重定向
        },
        back: () => {
          // TOD 后退
        },
        forward: () => {
          // TOD 前进
        },
        pushState: ({
          state,
          title,
          url,
        }: {
          state: any;
          title: string;
          url: string;
        }) => {
           // TOD 路由跳转
        },
        openTab: ({ url, title }: { url: string; title: string }) => {
          // TOD 打开新标签页
        }
      }
    }
  }

}

🤝 社区互助

如果您在使用过程中碰到问题,可以加入Mybricks社区,获得产品与服务支持!

❤️ 贡献者

感谢所有为Mybricks做出贡献的伙伴们!