JS 框架 词条目录
前端Wiki/词条/低代码平台

低代码平台

定义用拖拽配置与少量代码代替手写来搭建应用的研发方式,目标是把常见 CRUD 页面成本压到最低

低代码平台把表单、列表、详情、审批流这些高频页面抽象成可配置物料:拖入组件、配好数据源与校验规则即生成可用页面,多数还有一个出码导出的退路。对内部系统多、CRUD 需求密集的团队,能把大量重复活儿沉淀到平台里,让开发聚焦在真正定制化的部分。

它的能力边界明显:复杂交互动画、深度定制的渲染、性能极端要求的场往往做不了或做得很别扭,调试黑盒、版本升级绑死平台也是常见痛点。所以它在企业内部系统成效显著,面向 C 端的产品页面通常还是手写更可控。

JavaScript
// 低代码的最小数据模型:组件树 + 配置 驱动渲染(schema 思想)
var schema = {
  type: 'page',
  children: [
    { type: 'input', props: { label: '姓名', field: 'name', required: true } },
    { type: 'select', props: { label: '部门', field: 'dept', options: ['研发', '运营', '设计'] } },
    { type: 'button', props: { text: '提交', action: 'submit' } }
  ]
};

var registry = {
  input: function (c) {
    var el = document.createElement('input'); el.placeholder = c.props.label; el.dataset.field = c.props.field;
    return el;
  },
  select: function (c) {
    var el = document.createElement('select');
    c.props.options.forEach(function (o) { var op = document.createElement('option'); op.textContent = o; el.appendChild(op); });
    el.dataset.field = c.props.field;
    return el;
  },
  button: function (c) {
    var el = document.createElement('button'); el.textContent = c.props.text;
    el.addEventListener('click', function () { console.log('提交', collect()); });
    return el;
  }
};

function render(node) {
  return (registry[node.type] || function () { return document.createComment(node.type); })(node);
}
function collect() {
  return Array.prototype.reduce.call(document.querySelectorAll('[data-field]'), function (acc, el) {
    acc[el.dataset.field] = el.value; return acc;
  }, {});
}
schema.children.forEach(function (c) { document.body.appendChild(render(c)); });
⚠ 常见误区
🔗 相关词条脚手架组件通信
← 返回来源章节脚手架