自动发帖软件

标题: AIWROK软件hui动态生成复选框显示所有app [打印本页]

作者: 发帖软件    时间: 4 天前
标题: AIWROK软件hui动态生成复选框显示所有app
  1. // 官方QQ群 711841924


  2. function getChcek1() {
  3.     var check1 =
  4.     {
  5.         id: "check_c16291c6",
  6.         type: "check",
  7.         style: {
  8.             width: "300",
  9.             height: "auto",
  10.             position: "absolute",
  11.             top: 122,
  12.             left: 103,
  13.             right: "",
  14.             bottom: "",
  15.             borderWidth: "0",
  16.             borderColor: "",
  17.             borderStyle: "none",
  18.             backgroundImage: "",
  19.             backgroundColor: "",
  20.             backgroundRepeat: "no-repeat",
  21.             backgroundSize: "100% 100%",
  22.             color: "",
  23.             fontSize: "",
  24.             fontWeight: "",
  25.             transform: {
  26.                 rotate: "",
  27.                 scale: ""
  28.             }
  29.         },
  30.         name: "复选",
  31.         gid: "id_check_c16291c6",
  32.         text: "选项1",
  33.         checked: false,
  34.         events: "",
  35.         created: "",
  36.         mounted: "",
  37.         displayConds: []
  38.     };
  39.     return check1;
  40. }




  41. var json = JSON.parse(app.getAllApp());

  42. var checkArr = [];
  43. for (let i = 0; i < json.length; i++) {
  44.     printl(json[i].appName);
  45.     var check1=getChcek1();
  46.     check1.style.top=i*20;
  47.     check1.id="check"+i;
  48.     check1.text=json[i].appName;
  49.     checkArr.push(check1);
  50. }

  51. var checkBoxs = JSON.stringify(checkArr);
  52. printl(checkBoxs);


  53. hui.loadHui(`
  54. ({
  55.   id: "75f0extui9d7yksklx27hff8xg",
  56.   name: "test",
  57.   type: "app",
  58.   codeBlocks: {},
  59.   items: [
  60.     {
  61.       type: "page",
  62.       id: "page_299",
  63.       name: "index",
  64.       title: "",
  65.       layout: "absolute",
  66.       style: {
  67.         position: "relative",
  68.         left: 0,
  69.         top: 0,
  70.         right: "",
  71.         bottom: "",
  72.         width: "100%",
  73.         height: "1728",
  74.         backgroundImage: "",
  75.         backgroundColor: "rgba(255, 255, 255, 1)",
  76.         backgroundRepeat: "no-repeat",
  77.         backgroundSize: "100% 100%",
  78.         color: "",
  79.         fontSize: "",
  80.         fontWeight: "",
  81.         borderWidth: "0",
  82.         borderColor: "",
  83.         borderStyle: "none",
  84.         transform: {
  85.           rotate: "",
  86.           scale: ""
  87.         }
  88.       },
  89.       events: [],
  90.       created: {
  91.         hookType: "code",
  92.         hookData: []
  93.       },
  94.       items:
  95.         ${checkBoxs}
  96.       ,
  97.       mounted: {
  98.         hookType: "code",
  99.         hookData: []
  100.       },
  101.       displayConds: []
  102.     }
  103.   ],
  104.   dataSources: [],
  105.   dataSourceDeps: {
  106.     ds_b64c92b5: {}
  107.   },
  108.   dataSourceCondDeps: {
  109.     ds_b64c92b5: {}
  110.   }
  111. })

  112. `);

复制代码
这段代码的主要功能是从一个应用程序中获取所有应用的信息,并根据这些信息动态生成一系列复选框,然后将这些复选框加载到一个页面布局中。下面是对代码的逐段解释:







欢迎光临 自动发帖软件 (http://www.fatiegongju.com/) Powered by Discuz! X3.2