m3js是什么


基于M³平台的JavaScript库,目标是为M³平台小应用开发创建一个易于使用的工具库。该工具库提供了平台各类对象的接口封装,包括:

  • HTTP
  • MQL执行
  • Search执行
  • 作业管理
  • 文件系统管理
  • 标签管理
  • 规则管理
  • 日志管理
  • 用户管理
  • 权限管理
  • 消息管理
  • 常用工具函数

如何使用

npm install --save @wecise/m3js

import

const m3 = require("@wecise/m3js");
Vue.prototype.m3 = m3;

init

import("@wecise/m3js").then((m3)=>{
    m3.init(m3config).then(()=>{
        m3.pageSetting().then(()=>{
            new Vue({
                render: h => h(window.App),
            }).$mount('#app')
        }).catch((e)=>{
            console.error(e)
        })
    }).catch((e)=>{
        console.error(e)
    })
}).catch((e)=>{
    console.error(e)
});

调用

// 没有参数
this.m3.callFS("/matrix/eventConsole/getEventList.js").then( (res)=>{
    console.log(res)
}).catch( (err)=>{
    console.error(err)
} );

// 带参数
let param = encodeURIComponent(JSON.stringify({term:'m3'}));
this.m3.callFS("/matrix/eventConsole/getEventList.js", param).then( (res)=>{
    console.log(res)
}).catch( (err)=>{
    console.error(err)
} );

results matching ""

    No results matching ""