{"id":33001905,"url":"https://github.com/ianho/xing-weapp-component","last_synced_at":"2025-11-16T07:00:48.751Z","repository":{"id":147888154,"uuid":"124476300","full_name":"ianho/xing-weapp-component","owner":"ianho","description":"微信小程序基础组件扩展","archived":false,"fork":false,"pushed_at":"2020-06-17T09:46:05.000Z","size":274,"stargazers_count":194,"open_issues_count":8,"forks_count":36,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-07-02T04:44:42.679Z","etag":null,"topics":["component","javascript","weapp","xing"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ianho.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-03-09T02:29:46.000Z","updated_at":"2023-03-18T08:37:03.000Z","dependencies_parsed_at":"2023-05-27T20:00:38.992Z","dependency_job_id":null,"html_url":"https://github.com/ianho/xing-weapp-component","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ianho/xing-weapp-component","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ianho%2Fxing-weapp-component","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ianho%2Fxing-weapp-component/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ianho%2Fxing-weapp-component/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ianho%2Fxing-weapp-component/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ianho","download_url":"https://codeload.github.com/ianho/xing-weapp-component/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ianho%2Fxing-weapp-component/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":284672648,"owners_count":27044736,"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","status":"online","status_checked_at":"2025-11-16T02:00:05.974Z","response_time":65,"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":["component","javascript","weapp","xing"],"created_at":"2025-11-13T14:00:24.545Z","updated_at":"2025-11-16T07:00:48.743Z","avatar_url":"https://github.com/ianho.png","language":"JavaScript","funding_links":[],"categories":["组件"],"sub_categories":[],"readme":"⚠️ 太久没空更新，不确定是否可用\n\n# xing-weapp-component\n\n\u003e xing-weapp-component是小程序基础组件的扩展，不定期更新\n\n## xing组件简介\n\n|组件名|目录|扩展组件|扩展内容|\n|---|---|---|---|\n|xing-scroll-view|/xing-components/x-scroll-view|[scroll-view](https://mp.weixin.qq.com/debug/wxadoc/dev/component/scroll-view.html)|增加scroll-view自身的下拉刷新功能等|\n|xing-image|/xing-components/x-image|[image](https://mp.weixin.qq.com/debug/wxadoc/dev/component/image.html)|增加图片的占位图、破图等|\n\n- xing-scroll-view下拉刷新效果：\n\n![](http://lc-umun50np.cn-n1.lcfile.com/6515e054ab5cc9a533fa.gif)\n\n## 使用方法\n\n1. 下载代码，若已经安装微信开发者工具（1.02.1803130及以上版本）可[点击导入代码片段](http://lc-umun50np.cn-n1.lcfile.com/a402f35e1b50bd8567c6.html)\n\n1. 复制文件夹 `xing-components` 到你自己的项目中\n\n1. 在需要使用相关组件的页面的 `json` 文件中进行引用声明。此时需要提供每个自定义组件的标签名和对应的自定义组件文件路径：\n\n    ```javascript\n    {\n      \"usingComponents\": {\n        \"x-tag-name\": \"path/to/xing-components/x-tag-name\"\n      }\n    }\n    ```\n\n1. 在页面的 `wxml` 中就可以像使用基础组件一样使用自定义组件。节点名即自定义组件的标签名，节点属性即传递给组件的属性值。\n\n    ```xml\n    \u003cview\u003e\n      \u003cx-tag-name attr-name=\"attr-value\"\u003e\u003c/x-tag-name\u003e\n    \u003c/view\u003e\n    ```\n\n    \u003e 参考：[自定义组件官方文档](https://mp.weixin.qq.com/debug/wxadoc/dev/framework/custom-component/)\n\n## 组件文档\n\n### xing-scroll-view\n\n|属性名|类型|默认值|说明|\n|---|---|---|---|\n|pull-down-height|Number|60|下拉到多少高度时可刷新，单位为 `px` |\n|pull-text|String|下拉可以刷新|下拉还不能刷新时显示的文字|\n|release-text|String|松开立即刷新|下拉至可刷新时显示的文字|\n|loading-text|String|正在刷新数据中|刷新时显示的文字，尾部会自动接 `...` |\n|finish-text|String|刷新完成|刷新完成时显示的文字|\n|loadmore-text|String|正在加载更多数据|上拉加载更多时显示的文字|\n|nomore-text|String|已经全部加载完毕|上拉加载无数据后显示的文字|\n|refreshing|Boolean|false|是否正在刷新|\n|nomore|Boolean|false|是否没有更多数据（加载完毕）|\n|bindpulldownrefresh|HandleEvent||当下拉刷新时触发|\n|bindloadmore|HandleEvent||当滚动到底部时触发|\n|bindscroll|HandleEvent||同[scroll-view](https://mp.weixin.qq.com/debug/wxadoc/dev/component/scroll-view.html)|\n\n**注意：**\n\n1. 触发 `pulldownrefresh` 事件时，组件的 `refreshing` 属性会被设为 `true` ，刷新完成后将其设为 `false` 以完成刷新\n1. 当没有更多数据时，将组件的 `nomore` 属性设为 `true`\n1. 每页内容总高度应大于组件的高度，否则在底部加载时会出现问题，因此在当前页确定为最后一页时（如内容不足一页）就应该将 `nomore` 设为 `true`\n1. 使用微信开发者工具进行远程调试时，会出现奇怪的bug，应该是wxml调试监听的问题\n\n**示例**\n\n```xml\n\u003cview class=\"header\"\u003eheader\u003c/view\u003e\n\u003cx-scroll-view refreshing=\"{{refreshing}}\" nomore=\"{{nomore}}\" bindpulldownrefresh=\"_onPullDownRefresh\" bindloadmore=\"_onLoadmore\" bindscroll=\"_onScroll\"\u003e\n  \u003cblock wx:for=\"{{colors}}\" wx:for-index=\"index\" wx:key=\"index\"\u003e\n    \u003cview class=\"view\" style=\"background: {{item}}\"\u003e{{index + 1}}. {{item}}\u003c/view\u003e\n  \u003c/block\u003e\n\u003c/x-scroll-view\u003e\n```\n\n```javascript\nPage({\n\n  data: {\n    colors: [],\n  },\n\n  _randomColor: function () {\n    return `rgba(${Math.floor(Math.random() * 256)},${Math.floor(Math.random() * 256)},${Math.floor(Math.random() * 256)},${(Math.random() * 0.3 + 0.2).toFixed(1)})`;\n  },\n\n  _generateColors: function (length) {\n    return new Array(length).fill(null).map(() =\u003e this._randomColor());\n  },\n\n  //下拉刷新监听函数\n  _onPullDownRefresh: function () {\n    setTimeout(() =\u003e {\n      const colors = this._generateColors(20);\n      this.setData({\n        colors,\n        refreshing: false,\n      });\n    }, 2000);\n  },\n\n  //加载更多监听函数\n  _onLoadmore: function () {\n    setTimeout(() =\u003e {\n      if (this.data.colors.length == 80) {\n        this.setData({ nomore: true })\n      } else {\n        const colors = this._generateColors(20);\n        this.setData({ colors: [...this.data.colors, ...colors] });\n      }\n    }, 1000);\n  },\n\n  _onScroll: function (e) {\n    console.log(e);\n  },\n\n  onLoad: function (options) {\n    const colors = this._generateColors(20);\n    this.setData({ colors });\n  },\n})\n```\n\n### xing-image\n\n|属性名|类型|默认值|说明|\n|---|---|---|---|\n|src|String||同[image](https://mp.weixin.qq.com/debug/wxadoc/dev/component/image.html)|\n|mode|String|scaleToFill|同[image](https://mp.weixin.qq.com/debug/wxadoc/dev/component/image.html)|\n|lazy-load|Boolean|false|同[image](https://mp.weixin.qq.com/debug/wxadoc/dev/component/image.html)|\n|placeholder-image|String|data: image / png; base64, iVBOR...|占位图，支持url、base64、本地目录|\n|broken-image|String||图片加载失败时显示图片，支持url、base64、本地目录，若未设置则不显示|\n\n**注意：**\n\n1. `xing-image` 是 `block` 块级元素\n1. 在 `scroll-view` 下使用 `xing-image` 无法使用 `lazy-load` ，应该是小程序对 `scroll-view` 下的自定义组件内的 `image` 的 `lazy-load` 存在bug，会导致图片不加载\n\n**示例**\n\n```xml\n\u003cx-image class=\"x-image\" src=\"https://images.unsplash.com/photo-1516203294340-5ba5f612dc6a?ixlib=rb-0.3.5\u0026ixid=eyJhcHBfaWQiOjEyMDd9\u0026s=1b79294f231ab4799218e82818a07de1\u0026auto=format\u0026fit=crop\u0026w=500\u0026q=60\"\u003e\u003c/x-image\u003e\n\u003cx-image class=\"x-image\" src=\"https://images.unsplash.com/photo-1496134732667-ae8d2853a045?ixlib=rb-0.3.5\u0026ixid=eyJhcHBfaWQiOjEyMDd9\u0026s=e4dd1c9106a69065ccfa21a36cfb53b1\u0026auto=format\u0026fit=crop\u0026w=500\u0026q=60\" placeholder-image=\"/sources/placeholder.png\"\u003e\u003c/x-image\u003e\n\u003cx-image class=\"x-image\" src=\"http://www.fourzero.four\" broken-image=\"/sources/broken-image.png\"\u003e\u003c/x-image\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fianho%2Fxing-weapp-component","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fianho%2Fxing-weapp-component","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fianho%2Fxing-weapp-component/lists"}