{"id":16430253,"url":"https://github.com/fyl080801/jrender","last_synced_at":"2026-03-05T02:03:31.608Z","repository":{"id":41395450,"uuid":"403836446","full_name":"fyl080801/jrender","owner":"fyl080801","description":null,"archived":false,"fork":false,"pushed_at":"2022-09-09T03:01:15.000Z","size":1276,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-26T19:03:04.017Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fyl080801.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-09-07T04:10:27.000Z","updated_at":"2022-02-11T02:03:39.000Z","dependencies_parsed_at":"2022-07-30T08:38:06.179Z","dependency_job_id":null,"html_url":"https://github.com/fyl080801/jrender","commit_stats":null,"previous_names":[],"tags_count":82,"template":false,"template_full_name":null,"purl":"pkg:github/fyl080801/jrender","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fyl080801%2Fjrender","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fyl080801%2Fjrender/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fyl080801%2Fjrender/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fyl080801%2Fjrender/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fyl080801","download_url":"https://codeload.github.com/fyl080801/jrender/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fyl080801%2Fjrender/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30106158,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T01:39:18.192Z","status":"online","status_checked_at":"2026-03-05T02:00:06.710Z","response_time":93,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T08:26:17.359Z","updated_at":"2026-03-05T02:03:31.588Z","avatar_url":"https://github.com/fyl080801.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 说明\n\n基于 `vue2` 的界面渲染库\n\n## 表达式\n\n通过 `$:\u003cpath\u003e` 将值绑定到属性上\n\n```json\n{\n  \"text\": \"$:model.text\"\n}\n```\n\n支持函数表达式\n\n```json\n{\n  \"events\": {\n    \"click\": \"$:()=\u003e{ alert('clicked') }\"\n  }\n}\n```\n\n## 渲染前处理\n\n通过定义渲染前处理实现改变将要渲染的节点功能\n\n例如：原始定义如下\n\n```json\n{\n  \"component\": \"el-input\",\n  \"formItem\": { \"label\": \"input\" },\n  \"props\": { \"value\": \"$:model.obj.text\", \"placeholder\": \"input value\" },\n  \"events\": { \"input\": \"$:(e)=\u003eSET(model, 'obj.text', e)\" }\n}\n```\n\n定义一个处理 formItem 的方法\n\n```javascript\nconst onSetup = ({ onBeforeBind }) =\u003e {\n  onBeforeBind(() =\u003e (field, next) =\u003e {\n    if (!field.formItem) {\n      next(field);\n      return;\n    }\n\n    const formItem = field.formItem;\n\n    delete field.formItem;\n\n    return { component: \"el-form-item\", props: formItem, children: [field] };\n  });\n};\n```\n\n输出结果\n\n```html\n\u003cel-form-item label=\"input\"\u003e\n  \u003cel-input :value=\"model.obj.text\" @input=\"(e)=\u003eSET(model, 'obj.text', e)\" /\u003e\n\u003c/el-form-item\u003e\n```\n\n## 功能函数\n\n可在表达式中使用功能函数\n\n```yaml\n- component: el-checkbox\n  formItem:\n    label: checked\n  props:\n    value: $:GET(model, 'checked') # GET 深度获取值\n  events:\n    input: $:(e)=\u003eSET(model, 'checked', e) # 深度设置值\n```\n\n可使用 addFunction 添加自定义功能函数\n\n```javascript\nimport { nextTick } from \"@vue/composition-api\";\n\nuseRootRender(({ addFunction }: any) =\u003e {\n  addFunction(\"NEXTTICK\", (cb: any) =\u003e {\n    nextTick(cb);\n  });\n});\n```\n\n支持设置监听，实现数据发生变化后触发操作\n\n```yaml\nlisteners:\n  - watch: $:GET(model, 'arr', []).length\n    actions:\n      - handler: |\n          $:() =\u003e {\n            SET(model, 'checked', false); \n            NEXTTICK(() =\u003e { SET(model, 'checked', true) }); \n          }\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffyl080801%2Fjrender","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffyl080801%2Fjrender","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffyl080801%2Fjrender/lists"}