{"id":13789173,"url":"https://github.com/fudiwei/wepy2-com-dialog","last_synced_at":"2025-05-12T03:31:32.877Z","repository":{"id":57160735,"uuid":"219161303","full_name":"fudiwei/wepy2-com-dialog","owner":"fudiwei","description":"A component for displaying a dialog based on wepy.js 2.x. 基于 WePY2 的对话框组件。","archived":true,"fork":false,"pushed_at":"2021-07-30T03:21:26.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-29T01:29:51.814Z","etag":null,"topics":["wechat-miniprogram","wepy","wepy-com","wepy2"],"latest_commit_sha":null,"homepage":"","language":null,"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/fudiwei.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}},"created_at":"2019-11-02T13:57:10.000Z","updated_at":"2023-08-05T13:24:09.000Z","dependencies_parsed_at":"2022-08-24T08:11:19.336Z","dependency_job_id":null,"html_url":"https://github.com/fudiwei/wepy2-com-dialog","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/fudiwei%2Fwepy2-com-dialog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fudiwei%2Fwepy2-com-dialog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fudiwei%2Fwepy2-com-dialog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fudiwei%2Fwepy2-com-dialog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fudiwei","download_url":"https://codeload.github.com/fudiwei/wepy2-com-dialog/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225117137,"owners_count":17423344,"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":["wechat-miniprogram","wepy","wepy-com","wepy2"],"created_at":"2024-08-03T21:00:59.484Z","updated_at":"2024-11-18T02:32:33.030Z","avatar_url":"https://github.com/fudiwei.png","language":null,"funding_links":[],"categories":["微信小程序WePY框架开发资源汇总 ![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)"],"sub_categories":["WePY开源组件"],"readme":"# wepy2-com-dialog\n\n一个对话框组件。\n\n此组件依赖 [wepy](https://github.com/Tencent/wepy) 2.0.0+。\n\n如果你正在使用 wepy 1.x，请移步 [wepy-com-dialog](https://github.com/fudiwei/wepy-com-dialog)。\n\n---\n\n## 用法\n\n安装：\n\n``` shell\nnpm install @skit/wepy2-com-dialog --save\n```\n\n导入：\n\n``` html\n\u003ctemplate\u003e\n    \u003cui-dialog ref=\"ui-dialog\" /\u003e\n\u003c/template\u003e\n\u003cconfig\u003e\n{\n    usingComponents: {\n        'ui-dialog': 'module:@skit/wepy2-com-dialog'\n    }\n}\n\u003c/config\u003e\n\u003cscript\u003e\n    import Wepy from 'wepy';\n    \n    Wepy.page({\n        onShow() {\n            this.$refs['ui-dialog'].alert('hello world');\n        }\n    });\n\u003c/script\u003e\n```\n\n\u003e 注意：当前版本的 wepy-cli 存在 Bug，无法打包通过 `node_modules` 引入的 wpy 组件，解决方案请参考 [Issue#2554](https://github.com/Tencent/wepy/issues/2554)。\n\n### 可配置项\n\n#### 属性\n\n参数项 | 说明 | 类型 | 是否必填 | 默认值\n:---: | :--: | :--: | :---: | :---:\nprimaryTextColor | 确认按钮文字颜色\u003cbr\u003e（支持 16 进制色或 RGB/RGBA 色） | String | 否 | #90241a |\n\n#### 方法\n\n``` javascript\n/**\n * 显示提示对话框。\n * @param {Object} options 配置项。\n * @param {String} options.title 提示标题。\n * @param {String} options.content 提示文本。\n * @param {String} options.confirmText 确定按钮的文字，默认为\"好的\"。\n * @param {String} options.confirmTextColor 确定按钮的文字颜色（会覆盖 primaryTextColor 属性）。\n * @param {String} options.textAlign 提示文本的对齐方式，支持“left”、“center”、“right”，默认值为“center”。\n * @param {Function} options.success 点击按钮后的回调方法。\n */\nthis.$refs['ui-dialog'].alert({\n    title: '这是标题',\n    content: '这是内容',\n    confirmText: '确认',\n    confirmTextColor: '#1fb8ca',\n    textAlign: 'left',\n    success: (res) =\u003e {\n        // 点击确定按钮后执行操作\n    }\n});\n\n/**\n * 显示提示对话框。\n * @param {String} content 提示文本。\n */\nthis.$refs['ui-dialog'].alert('这是内容');\n\n/**\n * 显示确认对话框。\n * @param {Object} options 配置项。\n * @param {String} options.title 提示标题。\n * @param {String} options.content 提示文本。\n * @param {String} options.confirmText 确定按钮的文字，默认为\"好的\"。\n * @param {String} options.confirmTextColor 确定按钮的文字颜色（会覆盖 primaryTextColor 属性）。\n * @param {String} options.cancelText 取消按钮的文字，默认为\"取消\"。\n * @param {String} options.textAlign 提示文本的对齐方式，支持“left”、“center”、“right”，默认值为“center”。\n * @param {Function} options.success 点击按钮后的回调方法，该方法将接收一个表示被点击按钮索引的参数。\n */\nthis.$refs['ui-dialog'].confirm({\n    title: '这是标题',\n    content: '这是内容',\n    confirmText: '确认',\n    confirmTextColor: '#1fb8ca',\n    cancelText: '取消',\n    textAlign: 'left',\n    success: (res) =\u003e {\n        switch (res.index) {\n            case 0:\n                // 点击取消按钮后执行操作\n                break;\n            case 1:\n                // 点击确定按钮后执行操作\n                break;\n        }\n    }\n});\n\n/**\n * 显示确认对话框。\n * @param {String} content 提示文本。\n */\nthis.$refs['ui-dialog'].confirm('这是内容');\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffudiwei%2Fwepy2-com-dialog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffudiwei%2Fwepy2-com-dialog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffudiwei%2Fwepy2-com-dialog/lists"}