attrs

属性 描述 占位参数
remote-url 远程地址 {approot}
remote-xpath jquery元素过滤表达式 {cdn}
remote-js remote-url加载后执行的js脚本

源码逻辑

mounted() {
    let that = this;
    const appRoot=window.$bowUtil.getUrlRoot().trim('/');
    const cdnRoot=window.$appConfig.cdn.root.trim('/');
    const htmlT = that.$getHtml(that.$attrs["remote-url"].replace("{cdn}",cdnRoot).replace("{approot}",appRoot));
    if(that.$attrs["remote-xpath"]){
      // eslint-disable-next-line no-undef
      that.html=$(htmlT).find(that.$attrs["remote-xpath"]).html();
    }else{
       that.html=htmlT;
    }
    const remoteJs=that.$attrs["remote-js"];
    if(remoteJs){
      let js= [
          remoteJs.replace("{cdn}", cdnRoot).replace("{approot}",appRoot)
      ];
      const key=  that.$crypto.md5(remoteJs);
        //eslint-disable-next-line no-undef
        loadjs(js,key, {
            success: function (e) { },
            error: function (e) { },
        });
     }
      const remoteCss = that.$attrs["remote-css"];
    if (remoteCss) {
      let css = [
        remoteCss.replace("{cdn}", cdnRoot).replace("{approot}", appRoot),
      ];
      that.refcss = that.$crypto.md5(remoteCss);
      //eslint-disable-next-line no-undef
      loadjs(css, that.refcss, {
        success: function (e) {},
        error: function (e) {},
      });
    }
  },

栏目配置属性

1、remote-css对应的文件,需要补充bo-ajax-“css路径对应的md5加密”
2、https://www.cnblogs.com/Flylater/p/10438302.html

{
    "mkey": "bo-ajax-html",
    "field": "manager",
    "moulesShow": [
        "table",
        "action"
    ],
    "modulesHide": [
        "form"
    ],
    "position": "tab",
    "class": "el-icon-unlock",
    "menuClass": "nav-menu__all",
    "attrs": {
        "remote-url": "{approot}/page-components/icon-line.html",
        "remote-js": "{approot}/page-components/demo.js",
        "remote-css": "{approot}/page-components/demo.css",
        "remote-xpath": "",
        "label": "我的收藏",
        "row-primary-key": "label"
    },
    "popup": {
        "component": "bo-ajax-html"
    },
    "tab": {
        "component": "bo-ajax-html"
    }
}
文档更新时间: 2022-09-12 07:53   作者:admin