{"id":18157187,"url":"https://github.com/ffiirree/minx","last_synced_at":"2025-04-07T02:36:38.067Z","repository":{"id":128288551,"uuid":"109862265","full_name":"ffiirree/Minx","owner":"ffiirree","description":"mvvm","archived":false,"fork":false,"pushed_at":"2017-12-17T12:32:39.000Z","size":38,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-13T07:41:42.663Z","etag":null,"topics":["mvvm","mvvm-framework","mvvm-light"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/ffiirree.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,"governance":null}},"created_at":"2017-11-07T16:33:41.000Z","updated_at":"2022-01-10T03:40:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"461f2854-140c-47d3-80e4-df125e7e6790","html_url":"https://github.com/ffiirree/Minx","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ffiirree%2FMinx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ffiirree%2FMinx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ffiirree%2FMinx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ffiirree%2FMinx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ffiirree","download_url":"https://codeload.github.com/ffiirree/Minx/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247583828,"owners_count":20962068,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["mvvm","mvvm-framework","mvvm-light"],"created_at":"2024-11-02T06:05:37.284Z","updated_at":"2025-04-07T02:36:38.040Z","avatar_url":"https://github.com/ffiirree.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Minx\n\n## Minx是一个简单的MVVM框架.\n\n## 功能\n - [x] {{ xxx }}\n - [ ] x-html\n - [x] x-model\n - [x] x-if\n - [x] x-for\n - [x] :/x-attr:[attr]\n - [x] x-on:[event]\n \n ### 插值\n #### 文本 \n ```html\n \u003ch3\u003e {{ title }} \u003c/h3\u003e\n```\n#### 表达式\n```javascript\n{{ age + 1 }}\n{{ age ? 'YES' : 'NO' }}\n{{ fns['method']('hello') }}\n```\n\n### 指令\n#### x-model:双向绑定\n```html\n\u003cinput x-model=\"message\"\u003e\n```\n\n#### x-for: 列表\n```html\n\u003cli x-for=\"todo:list\"\u003e\n    \u003cdiv\u003e{{ todo.creator }}\u003c/div\u003e\n\u003c/li\u003e\n```\n或者使用索引\n```html\n\u003cli x-for=\"(todo:index):list\"\u003e\n    \u003cdiv\u003e{{ todo.creator }}\u003c/div\u003e\n\u003c/li\u003e\n```\n\n#### x-attr:[attr]: 为节点添加属性\n可以使用字符串进行拼接\n```html\n\u003cul :id=\"title\"\u003e\n\u003cdiv\u003e\u003ca x-attr:href=\"url\"\u003e{{ user }}的BLOG\u003c/a\u003e\u003c/div\u003e\n\u003cdiv x-attr:class=\"user\"\u003e\u003c/div\u003e\n\u003cp x-attr:href=\"url+'/'+todo.id\"\u003e\u003c/p\u003e\n```\n\n#### x-on:[event]:绑定事件\n可以使用参数，实际参数使用数组传入，按照索引使用参数\n```html\n\u003cbutton x-on:click=\"click('Hello')\"\u003eCLICK TO SAY: Hello\u003c/button\u003e\n``` \n\n#### x-if: 是否渲染该节点\n```html\n\u003cdiv x-if=\"value\"\u003e是否显示\u003c/div\u003e\n```\n\n### Router.hash\n```javascript\n// 获取hash值\nlet _hash = Router.hash.value;\n\n// 设置hash值\nRouter.hash.value = { scope: 0, page: 2 }; // url#!/scope=0\u0026page=2\n\n// 获取hash参数值\nRouter.hash.get('scope'); // 0\nRouter.hash.get('page');  // 2\n\n// 设置参数值\nRouter.hash.set('scope', 2); // url#!/scope=2\u0026page=2\nRouter.hash.set('page', 5);  // url#!/scope=2\u0026page=5\n\n// 绑定事件\nRouter.hash.change(()=\u003e{alter('change!')});\n\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fffiirree%2Fminx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fffiirree%2Fminx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fffiirree%2Fminx/lists"}