├── .circleci └── config.yml ├── .editorconfig ├── .github ├── CONTRIBUTING.md ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md └── PULL_REQUEST_TEMPLATE.md ├── .gitignore ├── .idea ├── .gitignore ├── codeStyles │ └── codeStyleConfig.xml ├── compiler.xml ├── deployment.xml ├── encodings.xml ├── inspectionProfiles │ └── Project_Default.xml ├── jsLibraryMappings.xml ├── markdown-navigator.xml ├── markdown-navigator │ └── profiles_settings.xml ├── misc.xml ├── modules.xml ├── runConfigurations │ ├── we_vue.xml │ └── we_vue_libs.xml ├── vcs.xml ├── watcherTasks.xml └── we-vue.iml ├── .prettierrc.js ├── .stylelintrc ├── .vscode ├── launch.json └── settings.json ├── CHANGELOG.md ├── CNAME ├── README.md ├── images ├── logo.png └── qrcode-demo.png ├── lerna.json ├── package.json ├── packages ├── demo │ ├── .browserslistrc │ ├── .editorconfig │ ├── .eslintignore │ ├── .eslintrc.js │ ├── .gitignore │ ├── README.md │ ├── babel.config.js │ ├── cypress.json │ ├── package.json │ ├── postcss.config.js │ ├── public │ │ ├── favicon.ico │ │ ├── images │ │ │ ├── lazyload_1.jpg │ │ │ ├── lazyload_2.jpg │ │ │ ├── lazyload_3.jpg │ │ │ ├── lazyload_4.jpg │ │ │ ├── lazyload_5.jpg │ │ │ ├── lazyload_6.jpg │ │ │ └── lazyload_7.jpg │ │ └── index.html │ ├── src │ │ ├── App.vue │ │ ├── assets │ │ │ ├── data │ │ │ │ └── area.js │ │ │ ├── images │ │ │ │ ├── icon_tabbar.png │ │ │ │ ├── vcode.jpg │ │ │ │ └── wevue_placeholder.png │ │ │ ├── logo.png │ │ │ └── scss │ │ │ │ ├── demo.scss │ │ │ │ └── var.scss │ │ ├── main.js │ │ ├── router │ │ │ ├── index.js │ │ │ └── nav.json │ │ ├── store.js │ │ └── views │ │ │ ├── 404.vue │ │ │ ├── actionsheet.vue │ │ │ ├── area-picker.vue │ │ │ ├── badge.vue │ │ │ ├── button.vue │ │ │ ├── cell.vue │ │ │ ├── checklist.vue │ │ │ ├── circle.vue │ │ │ ├── datetime-picker.vue │ │ │ ├── dialog.vue │ │ │ ├── flex.vue │ │ │ ├── footer.vue │ │ │ ├── form-preview.vue │ │ │ ├── grid.vue │ │ │ ├── header.vue │ │ │ ├── icons.vue │ │ │ ├── index.vue │ │ │ ├── infinite-scroll.vue │ │ │ ├── input.vue │ │ │ ├── lazyload.vue │ │ │ ├── loadmore.vue │ │ │ ├── number-spinner.vue │ │ │ ├── panel.vue │ │ │ ├── picker.vue │ │ │ ├── popup.vue │ │ │ ├── progress.vue │ │ │ ├── radio.vue │ │ │ ├── search-bar.vue │ │ │ ├── slider.vue │ │ │ ├── spinner.vue │ │ │ ├── swipe-cell.vue │ │ │ ├── swipe.vue │ │ │ ├── switch-cell.vue │ │ │ ├── switch.vue │ │ │ ├── tabbar.vue │ │ │ ├── tabs.vue │ │ │ ├── textarea.vue │ │ │ ├── toast.vue │ │ │ └── top-tips.vue │ ├── tests │ │ └── e2e │ │ │ ├── .eslintrc.js │ │ │ ├── plugins │ │ │ └── index.js │ │ │ ├── specs │ │ │ └── test.js │ │ │ └── support │ │ │ ├── commands.js │ │ │ └── index.js │ └── vue.config.js ├── docs │ ├── .babelrc │ ├── .editorconfig │ ├── .eslintrc.js │ ├── .gitignore │ ├── .prettierrc │ ├── README.md │ ├── add-frontmatter.js │ ├── app.html │ ├── assets │ │ └── css │ │ │ ├── main.scss │ │ │ ├── tailwind.css │ │ │ └── typora-vue-theme │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── README_CN.md │ │ │ ├── vue-dark.css │ │ │ ├── vue.css │ │ │ └── vue │ │ │ ├── 6xK3dSBYKcSV-LCoeQqfX1RYOo3qN67lqDY.woff2 │ │ │ ├── 6xK3dSBYKcSV-LCoeQqfX1RYOo3qNK7lqDY.woff2 │ │ │ ├── 6xK3dSBYKcSV-LCoeQqfX1RYOo3qNa7lqDY.woff2 │ │ │ ├── 6xK3dSBYKcSV-LCoeQqfX1RYOo3qNq7lqDY.woff2 │ │ │ ├── 6xK3dSBYKcSV-LCoeQqfX1RYOo3qO67lqDY.woff2 │ │ │ ├── 6xK3dSBYKcSV-LCoeQqfX1RYOo3qOK7l.woff2 │ │ │ ├── 6xK3dSBYKcSV-LCoeQqfX1RYOo3qPK7lqDY.woff2 │ │ │ ├── 6xKydSBYKcSV-LCoeQqfX1RYOo3i54rwkxduz8A.woff2 │ │ │ ├── 6xKydSBYKcSV-LCoeQqfX1RYOo3i54rwlBduz8A.woff2 │ │ │ ├── 6xKydSBYKcSV-LCoeQqfX1RYOo3i54rwlxdu.woff2 │ │ │ ├── 6xKydSBYKcSV-LCoeQqfX1RYOo3i54rwmBduz8A.woff2 │ │ │ ├── 6xKydSBYKcSV-LCoeQqfX1RYOo3i54rwmRduz8A.woff2 │ │ │ ├── 6xKydSBYKcSV-LCoeQqfX1RYOo3i54rwmhduz8A.woff2 │ │ │ ├── 6xKydSBYKcSV-LCoeQqfX1RYOo3i54rwmxduz8A.woff2 │ │ │ ├── 6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwkxduz8A.woff2 │ │ │ ├── 6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwlBduz8A.woff2 │ │ │ ├── 6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwlxdu.woff2 │ │ │ ├── 6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwmBduz8A.woff2 │ │ │ ├── 6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwmRduz8A.woff2 │ │ │ ├── 6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwmhduz8A.woff2 │ │ │ ├── 6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwmxduz8A.woff2 │ │ │ ├── L0x5DF4xlVMF-BfR8bXMIjhEq3-cXbKDO1w.woff2 │ │ │ ├── L0x5DF4xlVMF-BfR8bXMIjhFq3-cXbKDO1w.woff2 │ │ │ ├── L0x5DF4xlVMF-BfR8bXMIjhGq3-cXbKDO1w.woff2 │ │ │ ├── L0x5DF4xlVMF-BfR8bXMIjhHq3-cXbKDO1w.woff2 │ │ │ ├── L0x5DF4xlVMF-BfR8bXMIjhIq3-cXbKDO1w.woff2 │ │ │ ├── L0x5DF4xlVMF-BfR8bXMIjhLq3-cXbKD.woff2 │ │ │ └── L0x5DF4xlVMF-BfR8bXMIjhPq3-cXbKDO1w.woff2 │ ├── components │ │ ├── docsearch-box.vue │ │ ├── header.vue │ │ └── wevue-demo.vue │ ├── config │ │ ├── index.js │ │ ├── nav_v2.js │ │ └── nav_v3.js │ ├── generate-post-list.js │ ├── global.d.ts │ ├── jest.config.js │ ├── layouts │ │ ├── default.vue │ │ └── error.vue │ ├── markdown │ │ ├── contributing.md │ │ ├── troubleshooting.md │ │ ├── v2 │ │ │ ├── actionsheet.md │ │ │ ├── badge.md │ │ │ ├── button.md │ │ │ ├── cell-swipe.md │ │ │ ├── cell.md │ │ │ ├── checklist.md │ │ │ ├── circle.md │ │ │ ├── datetime-picker.md │ │ │ ├── dialog.md │ │ │ ├── flex.md │ │ │ ├── footer.md │ │ │ ├── form-preview.md │ │ │ ├── grid.md │ │ │ ├── header.md │ │ │ ├── icon.md │ │ │ ├── index.md │ │ │ ├── infinite-scroll.md │ │ │ ├── input.md │ │ │ ├── lazyload.md │ │ │ ├── loadmore.md │ │ │ ├── navbar.md │ │ │ ├── number-spinner.md │ │ │ ├── panel.md │ │ │ ├── picker.md │ │ │ ├── popup.md │ │ │ ├── progress.md │ │ │ ├── quickstart.md │ │ │ ├── radio.md │ │ │ ├── search-bar.md │ │ │ ├── slider.md │ │ │ ├── spinner.md │ │ │ ├── swipe.md │ │ │ ├── switch.md │ │ │ ├── tabbar.md │ │ │ ├── tabs.md │ │ │ ├── textarea.md │ │ │ ├── toast.md │ │ │ └── top-tips.md │ │ └── v3 │ │ │ ├── actionsheet.md │ │ │ ├── area-picker.md │ │ │ ├── badge.md │ │ │ ├── button.md │ │ │ ├── cell.md │ │ │ ├── checklist.md │ │ │ ├── circle.md │ │ │ ├── datetime-picker.md │ │ │ ├── dialog.md │ │ │ ├── flex.md │ │ │ ├── footer.md │ │ │ ├── form-preview.md │ │ │ ├── grid.md │ │ │ ├── header.md │ │ │ ├── icon.md │ │ │ ├── index.md │ │ │ ├── infinite-scroll.md │ │ │ ├── input.md │ │ │ ├── lazyload.md │ │ │ ├── loadmore.md │ │ │ ├── navbar.md │ │ │ ├── number-spinner.md │ │ │ ├── panel.md │ │ │ ├── picker.md │ │ │ ├── popup.md │ │ │ ├── progress.md │ │ │ ├── quickstart.md │ │ │ ├── radio.md │ │ │ ├── search-bar.md │ │ │ ├── slider.md │ │ │ ├── spinner.md │ │ │ ├── swipe-cell.md │ │ │ ├── swipe.md │ │ │ ├── switch-cell.md │ │ │ ├── switch.md │ │ │ ├── tabbar.md │ │ │ ├── tabs.md │ │ │ ├── textarea.md │ │ │ ├── toast.md │ │ │ └── top-tips.md │ ├── middleware │ │ └── README.md │ ├── nuxt.config.ts │ ├── package.json │ ├── pages │ │ ├── doc │ │ │ └── _version │ │ │ │ └── _title.vue │ │ └── index.vue │ ├── plugins │ │ └── README.md │ ├── static │ │ ├── README.md │ │ ├── favicon.ico │ │ ├── images │ │ │ ├── demo_qrcode.png │ │ │ ├── easy-to-use.jpg │ │ │ ├── full-document.jpg │ │ │ ├── logo.png │ │ │ └── online-demo.jpg │ │ ├── robots.txt │ │ └── svg │ │ │ └── icon_search.svg │ ├── store │ │ └── index.ts │ ├── tailwind.config.js │ ├── test │ │ └── Logo.spec.js │ ├── tsconfig.json │ └── tslint.json └── we-vue │ ├── .browserslistrc │ ├── .eslintignore │ ├── .eslintrc.js │ ├── .gitignore │ ├── .npmignore │ ├── .prettierrc.js │ ├── README.md │ ├── babel.config.js │ ├── build │ ├── build-lib.js │ ├── config.js │ ├── webpack.base.conf.js │ ├── webpack.dev.conf.js │ └── webpack.prod.conf.js │ ├── jest.config.js │ ├── package.json │ ├── postcss.config.js │ ├── src │ ├── assets │ │ ├── iconfont │ │ │ ├── iconfont.css │ │ │ ├── iconfont.eot │ │ │ ├── iconfont.svg │ │ │ ├── iconfont.ttf │ │ │ └── iconfont.woff │ │ └── loading-spin.svg │ ├── components │ │ ├── WActionsheet │ │ │ ├── WActionsheet.tsx │ │ │ ├── __test__ │ │ │ │ ├── WActionsheet.spec.ts │ │ │ │ └── __snapshots__ │ │ │ │ │ └── WActionsheet.spec.ts.snap │ │ │ └── index.ts │ │ ├── WAreaPicker │ │ │ ├── WAreaPicker.tsx │ │ │ ├── __test__ │ │ │ │ ├── WAreaPicker.spec.ts │ │ │ │ ├── __snapshots__ │ │ │ │ │ └── WAreaPicker.spec.ts.snap │ │ │ │ └── area.js │ │ │ └── index.ts │ │ ├── WBadge │ │ │ ├── WBadge.tsx │ │ │ ├── __test__ │ │ │ │ ├── WBadge.spec.ts │ │ │ │ └── __snapshots__ │ │ │ │ │ └── WBadge.spec.ts.snap │ │ │ └── index.ts │ │ ├── WButton │ │ │ ├── WButton.tsx │ │ │ ├── __test__ │ │ │ │ └── WButton.spec.ts │ │ │ └── index.ts │ │ ├── WCell │ │ │ ├── WCell.tsx │ │ │ ├── __test__ │ │ │ │ ├── WCell.spec.ts │ │ │ │ └── __snapshots__ │ │ │ │ │ └── WCell.spec.ts.snap │ │ │ └── index.ts │ │ ├── WChecklist │ │ │ ├── WChecklist.tsx │ │ │ ├── __test__ │ │ │ │ ├── WChecklist.spec.ts │ │ │ │ └── __snapshots__ │ │ │ │ │ └── WChecklist.spec.ts.snap │ │ │ └── index.ts │ │ ├── WCircle │ │ │ ├── WCircle.tsx │ │ │ ├── __test__ │ │ │ │ ├── WCircle.spec.ts │ │ │ │ └── __snapshots__ │ │ │ │ │ └── WCircle.spec.ts.snap │ │ │ └── index.ts │ │ ├── WDatetimePicker │ │ │ ├── WDatetimePicker.tsx │ │ │ ├── __test__ │ │ │ │ └── WDatetimePicker.spec.ts │ │ │ └── index.ts │ │ ├── WDialog │ │ │ ├── WDialog.tsx │ │ │ ├── __test__ │ │ │ │ └── WDialog.spec.ts │ │ │ └── index.ts │ │ ├── WFlex │ │ │ ├── WFlex.ts │ │ │ ├── __test__ │ │ │ │ ├── WFlex.spec.ts │ │ │ │ └── __snapshots__ │ │ │ │ │ └── WFlex.spec.ts.snap │ │ │ └── index.ts │ │ ├── WFlexItem │ │ │ ├── WFlexItem.ts │ │ │ ├── __test__ │ │ │ │ ├── WFlexItem.spec.ts │ │ │ │ └── __snapshots__ │ │ │ │ │ └── WFlexItem.spec.ts.snap │ │ │ └── index.ts │ │ ├── WFooter │ │ │ ├── WFooter.tsx │ │ │ ├── WFooterLink.ts │ │ │ ├── __test__ │ │ │ │ ├── WFooter.spec.ts │ │ │ │ ├── WFooterLink.spec.ts │ │ │ │ └── __snapshots__ │ │ │ │ │ ├── WFooter.spec.ts.snap │ │ │ │ │ └── WFooterLink.spec.ts.snap │ │ │ └── index.ts │ │ ├── WFormPreview │ │ │ ├── WFormPreview.tsx │ │ │ ├── __test__ │ │ │ │ ├── WFormPreview.spec.ts │ │ │ │ └── __snapshots__ │ │ │ │ │ └── WFormPreview.spec.ts.snap │ │ │ └── index.ts │ │ ├── WGrid │ │ │ ├── WGrid.ts │ │ │ ├── __test__ │ │ │ │ ├── WGrid.spec.ts │ │ │ │ └── __snapshots__ │ │ │ │ │ └── WGrid.spec.ts.snap │ │ │ └── index.ts │ │ ├── WGridItem │ │ │ ├── WGridItem.tsx │ │ │ ├── __test__ │ │ │ │ ├── WGridItem.spec.ts │ │ │ │ └── __snapshots__ │ │ │ │ │ └── WGridItem.spec.ts.snap │ │ │ └── index.ts │ │ ├── WGroup │ │ │ ├── WGroup.tsx │ │ │ ├── __test__ │ │ │ │ ├── WGroup.spec.ts │ │ │ │ └── __snapshots__ │ │ │ │ │ └── WGroup.spec.ts.snap │ │ │ └── index.ts │ │ ├── WHeader │ │ │ ├── WHeader.tsx │ │ │ ├── __test__ │ │ │ │ ├── WHeader.spec.ts │ │ │ │ └── __snapshots__ │ │ │ │ │ └── WHeader.spec.ts.snap │ │ │ └── index.ts │ │ ├── WIcon │ │ │ ├── WIcon.ts │ │ │ ├── __test__ │ │ │ │ ├── WIcon.spec.ts │ │ │ │ └── __snapshots__ │ │ │ │ │ └── WIcon.spec.ts.snap │ │ │ └── index.ts │ │ ├── WInput │ │ │ ├── WInput.tsx │ │ │ ├── __test__ │ │ │ │ ├── WInput.spec.ts │ │ │ │ └── __snapshots__ │ │ │ │ │ └── WInput.spec.ts.snap │ │ │ └── index.ts │ │ ├── WLoadmore │ │ │ ├── WLoadmore.tsx │ │ │ ├── __test__ │ │ │ │ ├── WLoadmore.spec.ts │ │ │ │ └── __snapshots__ │ │ │ │ │ └── WLoadmore.spec.ts.snap │ │ │ └── index.ts │ │ ├── WMediaBox │ │ │ ├── WMediaBox.tsx │ │ │ ├── __test__ │ │ │ │ ├── WMediaBox.spec.ts │ │ │ │ └── __snapshots__ │ │ │ │ │ └── WMediaBox.spec.ts.snap │ │ │ └── index.ts │ │ ├── WNumberSpinner │ │ │ ├── WNumberSpinner.tsx │ │ │ ├── __test__ │ │ │ │ ├── WNumberSpinner.spec.ts │ │ │ │ └── __snapshots__ │ │ │ │ │ └── WNumberSpinner.spec.ts.snap │ │ │ └── index.ts │ │ ├── WPanel │ │ │ ├── WPanel.tsx │ │ │ ├── __test__ │ │ │ │ ├── WPanel.spec.ts │ │ │ │ └── __snapshots__ │ │ │ │ │ └── WPanel.spec.ts.snap │ │ │ └── index.ts │ │ ├── WPicker │ │ │ ├── WPicker.tsx │ │ │ ├── WPickerColumn.tsx │ │ │ ├── __test__ │ │ │ │ ├── WPicker.spec.ts │ │ │ │ └── __snapshots__ │ │ │ │ │ └── WPicker.spec.ts.snap │ │ │ └── index.ts │ │ ├── WPopup │ │ │ ├── WPopup.tsx │ │ │ ├── __test__ │ │ │ │ ├── WPopup.spec.ts │ │ │ │ └── __snapshots__ │ │ │ │ │ └── WPopup.spec.ts.snap │ │ │ └── index.ts │ │ ├── WProgress │ │ │ ├── WProgress.tsx │ │ │ ├── __test__ │ │ │ │ ├── WProgress.spec.ts │ │ │ │ └── __snapshots__ │ │ │ │ │ └── WProgress.spec.ts.snap │ │ │ └── index.ts │ │ ├── WRadio │ │ │ ├── WRadio.tsx │ │ │ ├── __test__ │ │ │ │ ├── WRadio.spec.ts │ │ │ │ └── __snapshots__ │ │ │ │ │ └── WRadio.spec.ts.snap │ │ │ └── index.ts │ │ ├── WSearchBar │ │ │ ├── WSearchBar.tsx │ │ │ ├── __test__ │ │ │ │ ├── WSearchBar.spec.ts │ │ │ │ └── __snapshots__ │ │ │ │ │ └── WSearchBar.spec.ts.snap │ │ │ └── index.ts │ │ ├── WSlider │ │ │ ├── WSlider.tsx │ │ │ ├── __test__ │ │ │ │ ├── WSlider.spec.ts │ │ │ │ └── __snapshots__ │ │ │ │ │ └── WSlider.spec.ts.snap │ │ │ └── index.ts │ │ ├── WSpinner │ │ │ ├── WSpinner.tsx │ │ │ ├── __test__ │ │ │ │ ├── WSpinner.spec.ts │ │ │ │ └── __snapshots__ │ │ │ │ │ └── WSpinner.spec.ts.snap │ │ │ └── index.ts │ │ ├── WSwipe │ │ │ ├── WSwipe.tsx │ │ │ ├── __test__ │ │ │ │ ├── WSwipe.spec.ts │ │ │ │ └── __snapshots__ │ │ │ │ │ └── WSwipe.spec.ts.snap │ │ │ └── index.ts │ │ ├── WSwipeCell │ │ │ ├── WSwipeCell.tsx │ │ │ ├── __test__ │ │ │ │ ├── WSwipeCell.spec.ts │ │ │ │ └── __snapshots__ │ │ │ │ │ └── WSwipeCell.spec.ts.snap │ │ │ └── index.ts │ │ ├── WSwipeCellButton │ │ │ ├── WSwipeCellButton.ts │ │ │ ├── __test__ │ │ │ │ ├── WSwipeCellButton.spec.ts │ │ │ │ └── __snapshots__ │ │ │ │ │ └── WSwipeCellButton.spec.ts.snap │ │ │ └── index.ts │ │ ├── WSwipeItem │ │ │ ├── WSwipeItem.tsx │ │ │ └── index.ts │ │ ├── WSwitch │ │ │ ├── WSwitch.tsx │ │ │ ├── __test__ │ │ │ │ ├── WSwitch.spec.ts │ │ │ │ └── __snapshots__ │ │ │ │ │ └── WSwitch.spec.ts.snap │ │ │ └── index.ts │ │ ├── WSwitchCell │ │ │ ├── WSwitchCell.tsx │ │ │ ├── __test__ │ │ │ │ ├── WSwitchCell.spec.ts │ │ │ │ └── __snapshots__ │ │ │ │ │ └── WSwitchCell.spec.ts.snap │ │ │ └── index.ts │ │ ├── WTab │ │ │ ├── WTab.tsx │ │ │ ├── __test__ │ │ │ │ ├── WTab.spec.ts │ │ │ │ └── __snapshots__ │ │ │ │ │ └── WTab.spec.ts.snap │ │ │ └── index.ts │ │ ├── WTabbar │ │ │ ├── WTabbar.ts │ │ │ ├── __test__ │ │ │ │ ├── WTabbar.spec.ts │ │ │ │ └── __snapshots__ │ │ │ │ │ └── WTabbar.spec.ts.snap │ │ │ └── index.ts │ │ ├── WTabbarItem │ │ │ ├── WTabbarItem.tsx │ │ │ ├── __test__ │ │ │ │ ├── WTabbarItem.spec.ts │ │ │ │ └── __snapshots__ │ │ │ │ │ └── WTabbarItem.spec.ts.snap │ │ │ └── index.ts │ │ ├── WTabs │ │ │ ├── WTabs.tsx │ │ │ ├── __test__ │ │ │ │ ├── WTabs.spec.ts │ │ │ │ └── __snapshots__ │ │ │ │ │ └── WTabs.spec.ts.snap │ │ │ └── index.ts │ │ ├── WTextarea │ │ │ ├── WTextarea.tsx │ │ │ ├── __test__ │ │ │ │ ├── WTextarea.spec.ts │ │ │ │ └── __snapshots__ │ │ │ │ │ └── WTextarea.spec.ts.snap │ │ │ └── index.ts │ │ ├── WToast │ │ │ ├── WToast.tsx │ │ │ ├── __test__ │ │ │ │ └── WToast.spec.ts │ │ │ └── index.ts │ │ ├── WTopTips │ │ │ ├── WTopTips.tsx │ │ │ ├── __test__ │ │ │ │ ├── WTopTips.spec.ts │ │ │ │ └── __snapshots__ │ │ │ │ │ └── WTopTips.spec.ts.snap │ │ │ └── index.ts │ │ └── index.ts │ ├── directives │ │ ├── __test__ │ │ │ ├── click-outside.spec.ts │ │ │ └── infinite-scroll.spec.ts │ │ ├── click-outside.ts │ │ ├── index.ts │ │ └── infinite-scroll.ts │ ├── entry-lib.ts │ ├── globals.d.ts │ ├── index.ts │ ├── install.ts │ ├── mixins │ │ ├── find-parent │ │ │ ├── __test__ │ │ │ │ └── find-parent.spec.ts │ │ │ └── index.ts │ │ ├── picker │ │ │ └── index.ts │ │ ├── popup │ │ │ ├── Modal.tsx │ │ │ ├── __test__ │ │ │ │ └── popup.spec.ts │ │ │ ├── context.ts │ │ │ ├── index.ts │ │ │ └── manager.ts │ │ ├── routable │ │ │ ├── __test__ │ │ │ │ └── routable.spec.ts │ │ │ └── index.ts │ │ ├── toggleable │ │ │ ├── __test__ │ │ │ │ └── toggleable.spec.ts │ │ │ └── index.ts │ │ ├── touchable │ │ │ ├── __test__ │ │ │ │ └── touchable.spec.ts │ │ │ └── index.ts │ │ └── validatable │ │ │ └── index.ts │ ├── plugins │ │ ├── index.ts │ │ └── lazyload │ │ │ ├── __test__ │ │ │ └── lazyload.spec.ts │ │ │ └── index.ts │ ├── scss │ │ ├── actionsheet.scss │ │ ├── badge.scss │ │ ├── base.scss │ │ ├── base │ │ │ ├── fn.scss │ │ │ ├── mixin │ │ │ │ ├── mobile.scss │ │ │ │ ├── setArrow.scss │ │ │ │ ├── setOnepx.scss │ │ │ │ └── text.scss │ │ │ ├── reset.scss │ │ │ └── variable │ │ │ │ ├── color.scss │ │ │ │ ├── global.scss │ │ │ │ ├── weui-button.scss │ │ │ │ ├── weui-cell.scss │ │ │ │ ├── weui-dialog.scss │ │ │ │ ├── weui-grid.scss │ │ │ │ ├── weui-msg.scss │ │ │ │ └── weui-progress.scss │ │ ├── button.scss │ │ ├── cell-swipe-button.scss │ │ ├── cell-swipe.scss │ │ ├── cell.scss │ │ ├── checklist.scss │ │ ├── circle.scss │ │ ├── datetime-picker.scss │ │ ├── dialog.scss │ │ ├── flex.scss │ │ ├── footer.scss │ │ ├── form-preview.scss │ │ ├── grid.scss │ │ ├── group.scss │ │ ├── header.scss │ │ ├── icon.scss │ │ ├── index.scss │ │ ├── input.scss │ │ ├── loadmore.scss │ │ ├── media-box.scss │ │ ├── number-spinner.scss │ │ ├── panel.scss │ │ ├── picker.scss │ │ ├── popup.scss │ │ ├── progress.scss │ │ ├── radio.scss │ │ ├── search-bar.scss │ │ ├── slider.scss │ │ ├── spinner.scss │ │ ├── swipe.scss │ │ ├── switch.scss │ │ ├── tabbar.scss │ │ ├── tabs.scss │ │ ├── textarea.scss │ │ ├── toast.scss │ │ └── top-tips.scss │ ├── shims-tsx.d.ts │ └── utils │ │ ├── __test__ │ │ └── scrolll.spec.ts │ │ ├── event.ts │ │ ├── index.ts │ │ ├── mixins.ts │ │ ├── raf.ts │ │ ├── scroll.ts │ │ └── touches.ts │ ├── test │ └── unit │ │ ├── .eslintrc │ │ ├── setup.ts │ │ └── utils.ts │ ├── tsconfig.dist.json │ ├── tsconfig.json │ ├── tslint.json │ └── types │ ├── index.d.ts │ ├── lib.d.ts │ └── test │ ├── lib.ts │ └── tsconfig.json ├── scripts └── release.js ├── tsconfig.json └── yarn.lock /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # WE-VUE 贡献指南 2 | 3 | 首先,欢迎你使用 WE-VUE! 4 | 5 | WE-VUE 使用 Vue.js 将 weui.css 这一套微信官方视觉样式封装成了简单易用的组件,适合微信等移动端开发。 6 | 7 | WE-VUE 仍然在不断地丰富和完善中,它的进步需要大家的支持和参与,非常欢迎具有开源、分享精神的各路大佬贡献代码或提出宝贵建议,主了保证代码质量并方便维护,请在开始之前请阅读以下内容。 8 | 9 | ## Issue 规范 10 | 11 | - issue 仅用于提交 Bug 或 Feature,其它内容可能会被直接关闭。 12 | 13 | - 在提交 issue 之前,请搜索相关内容是否已被提出。 14 | 15 | - 请说明 WE-VUE 的版本号,并提供操作系统和浏览器信息。 16 | 17 | - 尽可能详细、明确地说明问题,为此可粘贴截图或相关代码片段,以便重现所提到的问题。 18 | 19 | ## Pull Request 规范 20 | 21 | - fork。 22 | 23 | - 本项目使用的严格的代码风格规范检查,以保证统一的风格和代码质量,请确保提交的代码遵守这些规范并能通过 Eslint 检查. 24 | 25 | - 如果是修复 Bug,请在 PR 中给出描述信息。 26 | 27 | - 对于新增功能,请附上说明,能加上相关的单元测试及文档更好。 28 | 29 | ## 代码规范 30 | 31 | - [JavaScript Standard Style](https://standardjs.com/) 32 | - [eslint-plugin-vue](https://github.com/vuejs/eslint-plugin-vue) 33 | 34 | 对于 eslint-plugin-vue 所检查的规则,请参阅其文档,同时也建议阅读 Vue.js 的[官方风格指南](https://cn.vuejs.org/v2/style-guide/)。 35 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | --- 8 | 9 | **环境信息:** 10 | - 设备: [e.g. iPhone6] 11 | - OS: [e.g. iOS8.1] 12 | - 浏览器: [e.g. chfome] 13 | - we-vue 版本: [e.g. v3.0.0] 14 | - 包管理工具: [npm/yarn] 15 | - Node.js 版本: 16 | 17 | **Bug 描述** 18 | 简要描述 BUG 19 | 20 | **重现** 21 | 重现步骤 22 | 1. Go to '...' 23 | 2. Click on '....' 24 | 25 | **预期结果** 26 | 描述预期得到的结果 27 | 28 | **截图或代码** 29 | 贴上截图或者相关使用代码,能更清楚的说明问题。 30 | 31 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 为了使您的 PR 更快速地被处理,在提交 PR 之前请您检查是否符合以下事项: 2 | 3 | * 确保您遵循了贡献指南。 4 | * 在创建 PR 前进行变基 (Rebase),以保证提交历史简洁清晰。 5 | * 对 PR 进行适当的描述或指定其针对的 Issue。 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | *.log* 4 | 5 | /.env 6 | 7 | !.idea 8 | -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /workspace.xml 3 | !/compiler.xml 4 | -------------------------------------------------------------------------------- /.idea/codeStyles/codeStyleConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.idea/deployment.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.idea/jsLibraryMappings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /.idea/markdown-navigator/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/runConfigurations/we_vue.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/runConfigurations/we_vue_libs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/watcherTasks.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.idea/we-vue.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | printWidth: 100, 3 | useTabs: false, 4 | tabWidth: 2, 5 | trailingComma: 'none', 6 | semi: false, 7 | singleQuote: true, 8 | } 9 | -------------------------------------------------------------------------------- /.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "stylelint-config-standard", 4 | "stylelint-config-rational-order" 5 | ], 6 | "rules": { 7 | "order/properties-order": [], 8 | "at-rule-no-unknown": null, 9 | "number-leading-zero": null, 10 | "no-descending-specificity": null, 11 | "declaration-colon-newline-after": null, 12 | "font-family-no-missing-generic-family-keyword": null 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "Debug jest tests", 9 | "type": "node", 10 | "request": "launch", 11 | "program": "${workspaceRoot}/node_modules/.bin/jest", 12 | "args": ["--runInBand", "${file}"] 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.rulers": [ 3 | 80 4 | ], 5 | "files.exclude": { 6 | "**/.git": true 7 | }, 8 | "editor.formatOnSave": false, 9 | "flow.useNPMPackagedFlow": true, 10 | "javascript.validate.enable": false, 11 | "jest.pathToJest": "yarn jest --", 12 | "prettier.eslintIntegration": true 13 | } 14 | -------------------------------------------------------------------------------- /CNAME: -------------------------------------------------------------------------------- 1 | wevue.org -------------------------------------------------------------------------------- /images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/images/logo.png -------------------------------------------------------------------------------- /images/qrcode-demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/images/qrcode-demo.png -------------------------------------------------------------------------------- /lerna.json: -------------------------------------------------------------------------------- 1 | { 2 | "command": { 3 | "publish": { 4 | "allowBranch": [ 5 | "master", 6 | "develop" 7 | ], 8 | "message": "chore(release): publish %s" 9 | } 10 | }, 11 | "npmClient": "yarn", 12 | "version": "3.0.0-alpha.22", 13 | "useWorkspaces": true 14 | } 15 | -------------------------------------------------------------------------------- /packages/demo/.browserslistrc: -------------------------------------------------------------------------------- 1 | > 1% 2 | last 2 versions 3 | not ie <= 8 4 | -------------------------------------------------------------------------------- /packages/demo/.editorconfig: -------------------------------------------------------------------------------- 1 | [*.{js,jsx,ts,tsx,vue}] 2 | indent_style = space 3 | indent_size = 2 4 | trim_trailing_whitespace = true 5 | insert_final_newline = true 6 | -------------------------------------------------------------------------------- /packages/demo/.eslintignore: -------------------------------------------------------------------------------- 1 | /src/assets 2 | -------------------------------------------------------------------------------- /packages/demo/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | node: true 5 | }, 6 | 'extends': [ 7 | 'plugin:vue/essential', 8 | '@vue/standard' 9 | ], 10 | rules: { 11 | 'no-console': 'off', 12 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off', 13 | 'comma-dangle': ['warn', 'always-multiline'], 14 | }, 15 | parserOptions: { 16 | parser: 'babel-eslint' 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/demo/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | # local env files 6 | .env.local 7 | .env.*.local 8 | 9 | # Log files 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | 14 | # Editor directories and files 15 | .idea 16 | .vscode 17 | *.suo 18 | *.ntvs* 19 | *.njsproj 20 | *.sln 21 | *.sw* 22 | -------------------------------------------------------------------------------- /packages/demo/README.md: -------------------------------------------------------------------------------- 1 | # demo 2 | 3 | ## Project setup 4 | ``` 5 | yarn install 6 | ``` 7 | 8 | ### Compiles and hot-reloads for development 9 | ``` 10 | yarn run serve 11 | ``` 12 | 13 | ### Compiles and minifies for production 14 | ``` 15 | yarn run build 16 | ``` 17 | 18 | ### Run your tests 19 | ``` 20 | yarn run test 21 | ``` 22 | 23 | ### Lints and fixes files 24 | ``` 25 | yarn run lint 26 | ``` 27 | 28 | ### Customize configuration 29 | See [Configuration Reference](https://cli.vuejs.org/config/). 30 | -------------------------------------------------------------------------------- /packages/demo/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | ['@vue/app', { 4 | useBuiltIns: 'entry', 5 | }], 6 | ], 7 | } 8 | -------------------------------------------------------------------------------- /packages/demo/cypress.json: -------------------------------------------------------------------------------- 1 | { 2 | "pluginsFile": "tests/e2e/plugins/index.js", 3 | "viewportWidth": 414, 4 | "viewportHeight": 736 5 | } 6 | -------------------------------------------------------------------------------- /packages/demo/postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | autoprefixer: {}, 4 | }, 5 | } 6 | -------------------------------------------------------------------------------- /packages/demo/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/demo/public/favicon.ico -------------------------------------------------------------------------------- /packages/demo/public/images/lazyload_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/demo/public/images/lazyload_1.jpg -------------------------------------------------------------------------------- /packages/demo/public/images/lazyload_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/demo/public/images/lazyload_2.jpg -------------------------------------------------------------------------------- /packages/demo/public/images/lazyload_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/demo/public/images/lazyload_3.jpg -------------------------------------------------------------------------------- /packages/demo/public/images/lazyload_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/demo/public/images/lazyload_4.jpg -------------------------------------------------------------------------------- /packages/demo/public/images/lazyload_5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/demo/public/images/lazyload_5.jpg -------------------------------------------------------------------------------- /packages/demo/public/images/lazyload_6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/demo/public/images/lazyload_6.jpg -------------------------------------------------------------------------------- /packages/demo/public/images/lazyload_7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/demo/public/images/lazyload_7.jpg -------------------------------------------------------------------------------- /packages/demo/src/App.vue: -------------------------------------------------------------------------------- 1 | 15 | 16 | 48 | -------------------------------------------------------------------------------- /packages/demo/src/assets/images/icon_tabbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/demo/src/assets/images/icon_tabbar.png -------------------------------------------------------------------------------- /packages/demo/src/assets/images/vcode.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/demo/src/assets/images/vcode.jpg -------------------------------------------------------------------------------- /packages/demo/src/assets/images/wevue_placeholder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/demo/src/assets/images/wevue_placeholder.png -------------------------------------------------------------------------------- /packages/demo/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/demo/src/assets/logo.png -------------------------------------------------------------------------------- /packages/demo/src/assets/scss/var.scss: -------------------------------------------------------------------------------- 1 | $color-default: #9c9c9c; 2 | $color-primary: #1aad19; 3 | $color-warn: #e64340; 4 | -------------------------------------------------------------------------------- /packages/demo/src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App.vue' 3 | import WeVue from 'we-vue' 4 | import './assets/scss/demo.scss' 5 | import router from './router' 6 | import QRCode from 'qrcode' 7 | import store from './store' 8 | import 'we-vue/dist/we-vue.css' 9 | 10 | Vue.config.productionTip = false 11 | Vue.config.devtools = true 12 | 13 | Vue.use(WeVue, { 14 | }) 15 | 16 | router.afterEach((to, from) => { 17 | document.title = to.meta.title 18 | 19 | const host = window.location.host 20 | const protocol = window.location.protocol 21 | 22 | const currentUrl = `${protocol}//${host}${to.fullPath}` 23 | 24 | QRCode.toDataURL(currentUrl) 25 | .then(url => { 26 | store.commit('UPDATE_QRCODE_URL', url) 27 | }) 28 | .catch(error => { 29 | console.error(error) 30 | }) 31 | }) 32 | 33 | /* eslint-disable no-new */ 34 | new Vue({ 35 | el: '#app', 36 | render: h => h(App), 37 | router, 38 | store, 39 | 40 | data () { 41 | return { 42 | transitionName: 'slide-right', 43 | } 44 | }, 45 | 46 | watch: { 47 | $route (to, from) { 48 | this.transitionName = from.name === 'index' ? 'slide-left' : 'slide-right' 49 | }, 50 | }, 51 | }) 52 | -------------------------------------------------------------------------------- /packages/demo/src/store.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Vuex from 'vuex' 3 | 4 | Vue.use(Vuex) 5 | 6 | export default new Vuex.Store({ 7 | state: { 8 | qrcodeUrl: '', 9 | }, 10 | 11 | mutations: { 12 | UPDATE_QRCODE_URL (state, value) { 13 | state.qrcodeUrl = value 14 | }, 15 | }, 16 | }) 17 | -------------------------------------------------------------------------------- /packages/demo/src/views/404.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 16 | -------------------------------------------------------------------------------- /packages/demo/src/views/circle.vue: -------------------------------------------------------------------------------- 1 | 27 | 28 | 37 | 38 | 49 | -------------------------------------------------------------------------------- /packages/demo/src/views/dialog.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 54 | 55 | 61 | -------------------------------------------------------------------------------- /packages/demo/src/views/footer.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 40 | 41 | 50 | -------------------------------------------------------------------------------- /packages/demo/src/views/header.vue: -------------------------------------------------------------------------------- 1 | 21 | 22 | 31 | 32 | 43 | -------------------------------------------------------------------------------- /packages/demo/src/views/icons.vue: -------------------------------------------------------------------------------- 1 | 18 | 19 | 39 | -------------------------------------------------------------------------------- /packages/demo/src/views/lazyload.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 24 | 25 | 56 | -------------------------------------------------------------------------------- /packages/demo/src/views/loadmore.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 14 | -------------------------------------------------------------------------------- /packages/demo/src/views/progress.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 50 | 51 | 56 | -------------------------------------------------------------------------------- /packages/demo/src/views/radio.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 46 | -------------------------------------------------------------------------------- /packages/demo/src/views/slider.vue: -------------------------------------------------------------------------------- 1 | 24 | 25 | 36 | 37 | 50 | -------------------------------------------------------------------------------- /packages/demo/src/views/spinner.vue: -------------------------------------------------------------------------------- 1 | 30 | 31 | 54 | -------------------------------------------------------------------------------- /packages/demo/src/views/switch-cell.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 20 | -------------------------------------------------------------------------------- /packages/demo/src/views/switch.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 24 | 25 | 42 | -------------------------------------------------------------------------------- /packages/demo/src/views/textarea.vue: -------------------------------------------------------------------------------- 1 | 30 | 31 | 41 | -------------------------------------------------------------------------------- /packages/demo/src/views/toast.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 49 | -------------------------------------------------------------------------------- /packages/demo/src/views/top-tips.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 38 | 39 | 44 | -------------------------------------------------------------------------------- /packages/demo/tests/e2e/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: [ 3 | 'cypress' 4 | ], 5 | env: { 6 | mocha: true, 7 | 'cypress/globals': true 8 | }, 9 | rules: { 10 | strict: 'off' 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/demo/tests/e2e/plugins/index.js: -------------------------------------------------------------------------------- 1 | // https://docs.cypress.io/guides/guides/plugins-guide.html 2 | 3 | // if you need a custom webpack configuration you can uncomment the following import 4 | // and then use the `file:preprocessor` event 5 | // as explained in the cypress docs 6 | // https://docs.cypress.io/api/plugins/preprocessors-api.html#Examples 7 | 8 | /* eslint-disable import/no-extraneous-dependencies, global-require, arrow-body-style */ 9 | // const webpack = require('@cypress/webpack-preprocessor') 10 | 11 | module.exports = (on, config) => { 12 | // on('file:preprocessor', webpack({ 13 | // webpackOptions: require('@vue/cli-service/webpack.config'), 14 | // watchOptions: {} 15 | // })) 16 | 17 | return Object.assign({}, config, { 18 | fixturesFolder: 'tests/e2e/fixtures', 19 | integrationFolder: 'tests/e2e/specs', 20 | screenshotsFolder: 'tests/e2e/screenshots', 21 | videosFolder: 'tests/e2e/videos', 22 | supportFile: 'tests/e2e/support/index.js', 23 | }) 24 | } 25 | -------------------------------------------------------------------------------- /packages/demo/tests/e2e/specs/test.js: -------------------------------------------------------------------------------- 1 | // https://docs.cypress.io/api/introduction/api.html 2 | 3 | describe('Test demo', () => { 4 | it('Visits root url', () => { 5 | cy.visit('/') 6 | }) 7 | }) 8 | -------------------------------------------------------------------------------- /packages/demo/tests/e2e/support/commands.js: -------------------------------------------------------------------------------- 1 | // *********************************************** 2 | // This example commands.js shows you how to 3 | // create various custom commands and overwrite 4 | // existing commands. 5 | // 6 | // For more comprehensive examples of custom 7 | // commands please read more here: 8 | // https://on.cypress.io/custom-commands 9 | // *********************************************** 10 | // 11 | // 12 | // -- This is a parent command -- 13 | // Cypress.Commands.add("login", (email, password) => { ... }) 14 | // 15 | // 16 | // -- This is a child command -- 17 | // Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... }) 18 | // 19 | // 20 | // -- This is a dual command -- 21 | // Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... }) 22 | // 23 | // 24 | // -- This is will overwrite an existing command -- 25 | // Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... }) 26 | -------------------------------------------------------------------------------- /packages/demo/tests/e2e/support/index.js: -------------------------------------------------------------------------------- 1 | // *********************************************************** 2 | // This example support/index.js is processed and 3 | // loaded automatically before your test files. 4 | // 5 | // This is a great place to put global configuration and 6 | // behavior that modifies Cypress. 7 | // 8 | // You can change the location of this file or turn off 9 | // automatically serving support files with the 10 | // 'supportFile' configuration option. 11 | // 12 | // You can read more here: 13 | // https://on.cypress.io/configuration 14 | // *********************************************************** 15 | 16 | // Import commands.js using ES2015 syntax: 17 | import './commands' 18 | 19 | // Alternatively you can use CommonJS syntax: 20 | // require('./commands') 21 | -------------------------------------------------------------------------------- /packages/demo/vue.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | devServer: { 3 | disableHostCheck: true, 4 | /** 5 | * IMPORTANT!!! 6 | * 默认情况下会忽略 node_modules 目录,这会导致 node_modules/we-vue/dist 中的文件发生变化时不会更动热替换,不便调试 7 | */ 8 | watchOptions: { 9 | ignored: [string => string.includes('node_modules') && !string.includes('we-vue')], 10 | }, 11 | }, 12 | css: { 13 | sourceMap: false, 14 | }, 15 | configureWebpack: { 16 | resolve: { 17 | symlinks: false, 18 | }, 19 | module: { 20 | rules: [ 21 | { 22 | test: /\.js$/, 23 | use: ['source-map-loader'], 24 | enforce: 'pre', 25 | }, 26 | ], 27 | }, 28 | }, 29 | } 30 | -------------------------------------------------------------------------------- /packages/docs/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "test": { 4 | "presets": [ 5 | [ 6 | "@babel/preset-env", 7 | { 8 | "targets": { 9 | "node": "current" 10 | } 11 | } 12 | ] 13 | ] 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/docs/.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /packages/docs/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | browser: true, 5 | node: true 6 | }, 7 | parserOptions: { 8 | parser: '@typescript-eslint/parser' 9 | }, 10 | extends: [ 11 | '@nuxtjs', 12 | 'plugin:nuxt/recommended', 13 | 'plugin:prettier/recommended', 14 | 'prettier', 15 | 'prettier/vue' 16 | ], 17 | plugins: [ 18 | '@typescript-eslint', 19 | 'prettier' 20 | ], 21 | // add your custom rules here 22 | rules: { 23 | 'no-console': 'off', 24 | 'vue/no-v-html': 'off', 25 | 'vue/require-default-prop': 'off', 26 | }, 27 | overrides: [ 28 | { 29 | files: ['**/*.ts', '**/*.tsx'], 30 | rules: { 31 | 'import/export': 'off', 32 | 'no-unused-vars': 'off', 33 | '@typescript-eslint/prefer-namespace-keyword': 'error', 34 | '@typescript-eslint/adjacent-overload-signatures': 'error', 35 | '@typescript-eslint/member-delimiter-style': ['error', { 36 | multiline: { 37 | delimiter: 'none' 38 | }, 39 | singleline: { 40 | delimiter: 'comma' 41 | } 42 | }], 43 | '@typescript-eslint/member-ordering': 'off', 44 | '@typescript-eslint/type-annotation-spacing': 'error', 45 | } 46 | } 47 | ] 48 | } 49 | -------------------------------------------------------------------------------- /packages/docs/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 100, 3 | "semi": false, 4 | "singleQuote": true, 5 | "trailingComma": "es5", 6 | "endOfLine": "auto", 7 | "overrides": [ 8 | { 9 | "files": "*.scss", 10 | "options": { 11 | "semi": true, 12 | "singleQuote": false 13 | } 14 | } 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /packages/docs/README.md: -------------------------------------------------------------------------------- 1 | # docs 2 | 3 | > My brilliant Nuxt.js project 4 | 5 | ## Build Setup 6 | 7 | ``` bash 8 | # install dependencies 9 | $ yarn install 10 | 11 | # serve with hot reload at localhost:3000 12 | $ yarn run dev 13 | 14 | # build for production and launch server 15 | $ yarn run build 16 | $ yarn start 17 | 18 | # generate static project 19 | $ yarn run generate 20 | ``` 21 | 22 | For detailed explanation on how things work, checkout [Nuxt.js docs](https://nuxtjs.org). 23 | -------------------------------------------------------------------------------- /packages/docs/add-frontmatter.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | const fs = require('fs-extra') 3 | const matter = require('gray-matter') 4 | const prependFile = require('prepend-file') 5 | const changeCase = require('change-case') 6 | 7 | const list = fs.readdirSync(path.resolve(__dirname, 'markdown/v3')) 8 | 9 | const posts = list.filter(item => item.endsWith('.md')).map(item => item.replace('.md', '')) 10 | 11 | posts.forEach(post => { 12 | const title = changeCase.pascalCase(post.replace(/-/g, ' ')) 13 | 14 | const frontmatterData = { 15 | title, 16 | keywords: `we-vue, ${post}`, 17 | description: '', 18 | demo_url: `//demo.wevue.org/${post}`, 19 | // categories: ['2_WE-VUE 组件', '1_基础组件'], 20 | // sort: 1, 21 | } 22 | 23 | const mdContent = matter.stringify('', frontmatterData) 24 | 25 | prependFile(`markdown/v3/${post}.md`, mdContent, error => { 26 | console.log(error) 27 | }) 28 | 29 | console.log(post, title) 30 | }) 31 | -------------------------------------------------------------------------------- /packages/docs/app.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{ HEAD }} 5 | 17 | 18 | 24 | 25 | 26 | {{ APP }} 27 | 28 | 29 | -------------------------------------------------------------------------------- /packages/docs/assets/css/typora-vue-theme/vue/6xK3dSBYKcSV-LCoeQqfX1RYOo3qN67lqDY.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/docs/assets/css/typora-vue-theme/vue/6xK3dSBYKcSV-LCoeQqfX1RYOo3qN67lqDY.woff2 -------------------------------------------------------------------------------- /packages/docs/assets/css/typora-vue-theme/vue/6xK3dSBYKcSV-LCoeQqfX1RYOo3qNK7lqDY.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/docs/assets/css/typora-vue-theme/vue/6xK3dSBYKcSV-LCoeQqfX1RYOo3qNK7lqDY.woff2 -------------------------------------------------------------------------------- /packages/docs/assets/css/typora-vue-theme/vue/6xK3dSBYKcSV-LCoeQqfX1RYOo3qNa7lqDY.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/docs/assets/css/typora-vue-theme/vue/6xK3dSBYKcSV-LCoeQqfX1RYOo3qNa7lqDY.woff2 -------------------------------------------------------------------------------- /packages/docs/assets/css/typora-vue-theme/vue/6xK3dSBYKcSV-LCoeQqfX1RYOo3qNq7lqDY.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/docs/assets/css/typora-vue-theme/vue/6xK3dSBYKcSV-LCoeQqfX1RYOo3qNq7lqDY.woff2 -------------------------------------------------------------------------------- /packages/docs/assets/css/typora-vue-theme/vue/6xK3dSBYKcSV-LCoeQqfX1RYOo3qO67lqDY.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/docs/assets/css/typora-vue-theme/vue/6xK3dSBYKcSV-LCoeQqfX1RYOo3qO67lqDY.woff2 -------------------------------------------------------------------------------- /packages/docs/assets/css/typora-vue-theme/vue/6xK3dSBYKcSV-LCoeQqfX1RYOo3qOK7l.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/docs/assets/css/typora-vue-theme/vue/6xK3dSBYKcSV-LCoeQqfX1RYOo3qOK7l.woff2 -------------------------------------------------------------------------------- /packages/docs/assets/css/typora-vue-theme/vue/6xK3dSBYKcSV-LCoeQqfX1RYOo3qPK7lqDY.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/docs/assets/css/typora-vue-theme/vue/6xK3dSBYKcSV-LCoeQqfX1RYOo3qPK7lqDY.woff2 -------------------------------------------------------------------------------- /packages/docs/assets/css/typora-vue-theme/vue/6xKydSBYKcSV-LCoeQqfX1RYOo3i54rwkxduz8A.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/docs/assets/css/typora-vue-theme/vue/6xKydSBYKcSV-LCoeQqfX1RYOo3i54rwkxduz8A.woff2 -------------------------------------------------------------------------------- /packages/docs/assets/css/typora-vue-theme/vue/6xKydSBYKcSV-LCoeQqfX1RYOo3i54rwlBduz8A.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/docs/assets/css/typora-vue-theme/vue/6xKydSBYKcSV-LCoeQqfX1RYOo3i54rwlBduz8A.woff2 -------------------------------------------------------------------------------- /packages/docs/assets/css/typora-vue-theme/vue/6xKydSBYKcSV-LCoeQqfX1RYOo3i54rwlxdu.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/docs/assets/css/typora-vue-theme/vue/6xKydSBYKcSV-LCoeQqfX1RYOo3i54rwlxdu.woff2 -------------------------------------------------------------------------------- /packages/docs/assets/css/typora-vue-theme/vue/6xKydSBYKcSV-LCoeQqfX1RYOo3i54rwmBduz8A.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/docs/assets/css/typora-vue-theme/vue/6xKydSBYKcSV-LCoeQqfX1RYOo3i54rwmBduz8A.woff2 -------------------------------------------------------------------------------- /packages/docs/assets/css/typora-vue-theme/vue/6xKydSBYKcSV-LCoeQqfX1RYOo3i54rwmRduz8A.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/docs/assets/css/typora-vue-theme/vue/6xKydSBYKcSV-LCoeQqfX1RYOo3i54rwmRduz8A.woff2 -------------------------------------------------------------------------------- /packages/docs/assets/css/typora-vue-theme/vue/6xKydSBYKcSV-LCoeQqfX1RYOo3i54rwmhduz8A.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/docs/assets/css/typora-vue-theme/vue/6xKydSBYKcSV-LCoeQqfX1RYOo3i54rwmhduz8A.woff2 -------------------------------------------------------------------------------- /packages/docs/assets/css/typora-vue-theme/vue/6xKydSBYKcSV-LCoeQqfX1RYOo3i54rwmxduz8A.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/docs/assets/css/typora-vue-theme/vue/6xKydSBYKcSV-LCoeQqfX1RYOo3i54rwmxduz8A.woff2 -------------------------------------------------------------------------------- /packages/docs/assets/css/typora-vue-theme/vue/6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwkxduz8A.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/docs/assets/css/typora-vue-theme/vue/6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwkxduz8A.woff2 -------------------------------------------------------------------------------- /packages/docs/assets/css/typora-vue-theme/vue/6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwlBduz8A.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/docs/assets/css/typora-vue-theme/vue/6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwlBduz8A.woff2 -------------------------------------------------------------------------------- /packages/docs/assets/css/typora-vue-theme/vue/6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwlxdu.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/docs/assets/css/typora-vue-theme/vue/6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwlxdu.woff2 -------------------------------------------------------------------------------- /packages/docs/assets/css/typora-vue-theme/vue/6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwmBduz8A.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/docs/assets/css/typora-vue-theme/vue/6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwmBduz8A.woff2 -------------------------------------------------------------------------------- /packages/docs/assets/css/typora-vue-theme/vue/6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwmRduz8A.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/docs/assets/css/typora-vue-theme/vue/6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwmRduz8A.woff2 -------------------------------------------------------------------------------- /packages/docs/assets/css/typora-vue-theme/vue/6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwmhduz8A.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/docs/assets/css/typora-vue-theme/vue/6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwmhduz8A.woff2 -------------------------------------------------------------------------------- /packages/docs/assets/css/typora-vue-theme/vue/6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwmxduz8A.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/docs/assets/css/typora-vue-theme/vue/6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwmxduz8A.woff2 -------------------------------------------------------------------------------- /packages/docs/assets/css/typora-vue-theme/vue/L0x5DF4xlVMF-BfR8bXMIjhEq3-cXbKDO1w.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/docs/assets/css/typora-vue-theme/vue/L0x5DF4xlVMF-BfR8bXMIjhEq3-cXbKDO1w.woff2 -------------------------------------------------------------------------------- /packages/docs/assets/css/typora-vue-theme/vue/L0x5DF4xlVMF-BfR8bXMIjhFq3-cXbKDO1w.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/docs/assets/css/typora-vue-theme/vue/L0x5DF4xlVMF-BfR8bXMIjhFq3-cXbKDO1w.woff2 -------------------------------------------------------------------------------- /packages/docs/assets/css/typora-vue-theme/vue/L0x5DF4xlVMF-BfR8bXMIjhGq3-cXbKDO1w.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/docs/assets/css/typora-vue-theme/vue/L0x5DF4xlVMF-BfR8bXMIjhGq3-cXbKDO1w.woff2 -------------------------------------------------------------------------------- /packages/docs/assets/css/typora-vue-theme/vue/L0x5DF4xlVMF-BfR8bXMIjhHq3-cXbKDO1w.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/docs/assets/css/typora-vue-theme/vue/L0x5DF4xlVMF-BfR8bXMIjhHq3-cXbKDO1w.woff2 -------------------------------------------------------------------------------- /packages/docs/assets/css/typora-vue-theme/vue/L0x5DF4xlVMF-BfR8bXMIjhIq3-cXbKDO1w.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/docs/assets/css/typora-vue-theme/vue/L0x5DF4xlVMF-BfR8bXMIjhIq3-cXbKDO1w.woff2 -------------------------------------------------------------------------------- /packages/docs/assets/css/typora-vue-theme/vue/L0x5DF4xlVMF-BfR8bXMIjhLq3-cXbKD.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/docs/assets/css/typora-vue-theme/vue/L0x5DF4xlVMF-BfR8bXMIjhLq3-cXbKD.woff2 -------------------------------------------------------------------------------- /packages/docs/assets/css/typora-vue-theme/vue/L0x5DF4xlVMF-BfR8bXMIjhPq3-cXbKDO1w.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/docs/assets/css/typora-vue-theme/vue/L0x5DF4xlVMF-BfR8bXMIjhPq3-cXbKDO1w.woff2 -------------------------------------------------------------------------------- /packages/docs/config/index.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable camelcase */ 2 | 3 | import v2 from './nav_v2' 4 | import v3 from './nav_v3' 5 | 6 | const nav = { 7 | v2, 8 | v3, 9 | } 10 | 11 | export { nav } 12 | -------------------------------------------------------------------------------- /packages/docs/generate-post-list.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | const fs = require('fs-extra') 3 | const matter = require('gray-matter') 4 | // const changeCase = require('change-case') 5 | const _ = require('lodash') 6 | 7 | const list = fs.readdirSync(path.resolve(__dirname, 'markdown/v2')) 8 | 9 | const posts = list.filter(item => item.endsWith('.md')).map(item => item.replace('.md', '')) 10 | 11 | let jsonData = posts.map(post => { 12 | // const title = changeCase.pascalCase(post.replace(/-/g, ' ')) 13 | 14 | const frontmatterData = matter.read(`./markdown/v2/${post}.md`) 15 | 16 | return { 17 | file: post, 18 | ...frontmatterData.data, 19 | } 20 | }) 21 | 22 | jsonData = _.groupBy(jsonData, item => { 23 | // console.log(item.categories['0']) 24 | return item.categories[0] 25 | }) 26 | 27 | jsonData['2_WE-VUE 组件'] = _.groupBy(jsonData['2_WE-VUE 组件'], item => { 28 | return item.categories[1] 29 | }) 30 | 31 | // jsonData = _.orderBy(jsonData) 32 | 33 | // 写入 json 34 | fs.writeJson('./test.json', jsonData, { 35 | spaces: 2, 36 | }) 37 | -------------------------------------------------------------------------------- /packages/docs/global.d.ts: -------------------------------------------------------------------------------- 1 | import VueI18n from 'vue-i18n' 2 | 3 | declare module 'vue/types/vue' { 4 | interface Vue { 5 | $t: typeof VueI18n.prototype.t 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/docs/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | moduleNameMapper: { 3 | '^@/(.*)$': '/$1', 4 | '^~/(.*)$': '/$1', 5 | '^vue$': 'vue/dist/vue.common.js', 6 | }, 7 | moduleFileExtensions: ['js', 'vue', 'json'], 8 | transform: { 9 | '^.+\\.js$': 'babel-jest', 10 | '.*\\.(vue)$': 'vue-jest', 11 | }, 12 | collectCoverage: true, 13 | collectCoverageFrom: ['/components/**/*.vue', '/pages/**/*.vue'], 14 | } 15 | -------------------------------------------------------------------------------- /packages/docs/layouts/default.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 33 | -------------------------------------------------------------------------------- /packages/docs/layouts/error.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 14 | 15 | 28 | -------------------------------------------------------------------------------- /packages/docs/markdown/contributing.md: -------------------------------------------------------------------------------- 1 | 贡献指南 2 | 3 | 非常欢迎你加入 WE-VUE 的开发,这份文件将帮助你了解开发流程。 4 | 5 | ## 开发 6 | 7 | ### 开始之前 8 | 9 | 请遵守以下准则: 10 | 11 | - 代码需要通过 Eslint 规范检查。 12 | - 使用 2 个空格缩进,不要使用 Tab 制表符缩进。 13 | - 不要把逗号放在最前面。 14 | 15 | ### 工作流程 16 | 17 | 1. Fork [tianyong90/we-vue](https://github.com/tianyong90/we-vue) 18 | 2. 把库(repository)复制到电脑上,并安装所依赖的插件。 19 | 20 | ```bash 21 | git clone https://github.com//we-vue.git 22 | cd we-vue 23 | npm install 24 | ``` 25 | 26 | 3. 新增一个功能分支。 27 | 28 | ```bash 29 | git checkout -b new_feature 30 | ``` 31 | 32 | 4. 开始开发。 33 | 5. 推送(push)分支。 34 | 35 | ```bash 36 | git push origin new_feature 37 | ``` 38 | 39 | 6. 建立一个新的合并申请(pull request)并描述变动。 40 | 41 | ### 注意事项 42 | 43 | - 不要修改 `package.json` 的版本号。 44 | - 代码必须通过 Eslint 代码规范检查,并请保留一些必要的注释。 45 | - 在建立 PR 之前请进行变基(rebase)操作,确保与主仓库 master 分支无重大冲突。 46 | 47 | ## 反馈问题 48 | 49 | 当你在使用 WE-VUE 遇到问题时,你可以尝试在 [问题解答](http://wevue.org/doc/troubleshooting) 中寻找解答,或是在 [GitHub](https://github.com/tianyong90/we-vue/issues) 上进行反馈。 50 | 51 | 1. 描述具体问题及重现步骤。 52 | 3. 附上相关代码及调试信息。 53 | 54 | [we-vue 项目地址](https://github.com/tianyong90/we-vue) 55 | -------------------------------------------------------------------------------- /packages/docs/markdown/troubleshooting.md: -------------------------------------------------------------------------------- 1 | 问题解答 2 | 3 | 1. 对于按需引入,推荐使用 `babel-plugin-import` 插件。 4 | 5 | 2. 如果使用 cnpm 安装依赖,出现一些类似模块无法加载(例如 `Module not found: Error: Can't resolve 'vue-style-loader'`)的问题。可使用 npm 或 yarn 重装安装依赖。 6 | 7 | 3. 图标无法显示 [issue #46](https://github.com/tianyong90/we-vue/issues/46) 8 | 9 | -------------------------------------------------------------------------------- /packages/docs/markdown/v2/badge.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Badge 3 | keywords: 'we-vue, badge' 4 | description: '' 5 | demo_url: //demo.wevue.org/badge 6 | --- 7 | 8 | Badge 9 | 10 | 小徽章,支持不同颜色,包含小红点状态。 11 | 12 | ## 引入 13 | 14 | ```js 15 | import { Badge } from 'we-vue' 16 | 17 | Vue.use(Badge) 18 | ``` 19 | 20 | ## 例子 21 | 22 | ### 基本使用 23 | 24 | ```html 25 | 20 26 | ``` 27 | 28 | ### 指定背景色 29 | 30 | ```html 31 | 20 32 | ``` 33 | 34 | ### 指定为小红点状态 35 | 36 | ```html 37 | 38 | ``` 39 | 40 | ## API 41 | 42 | | 参数 | 类型 | 说明 | 可选值 | 默认值 | 43 | | :----: | :-----: | :----: | :--: | :---: | 44 | | color | String | 背景色 | | | 45 | | is-dot | Boolean | 是否是为红点 | | false | 46 | -------------------------------------------------------------------------------- /packages/docs/markdown/v2/circle.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Circle 3 | keywords: 'we-vue, circle' 4 | description: '' 5 | demo_url: //demo.wevue.org/circle 6 | --- 7 | 8 | Circle 9 | 10 | 环形进度指示。 11 | 12 | ## 引入 13 | 14 | ```js 15 | import { Circle } from 'we-vue' 16 | 17 | Vue.use(Circle) 18 | ``` 19 | 20 | ## 例子 21 | 22 | ### 指定线宽 23 | 24 | ```html 25 | 12 % 26 | ``` 27 | 28 | ### 指定填充色 29 | 30 | ```html 31 | 12 % 32 | ``` 33 | 34 | ### 指定直径 35 | 36 | ```html 37 | {{ sliderValue }}% 38 | ``` 39 | 40 | ## API 41 | 42 | | 参数 | 类型 | 说明 | 可选值 | 默认值 | 43 | | :----: | :-----: | :----: | :--: | :---: | 44 | | diameter | Number | 圆环直径 | | 100 | 45 | | line-width | Number | 线宽 | | 4 | 46 | | stroke-color | String | 主色 | | '#3FC7FA' | 47 | | trail-color | String | 轨道色 | | '#D9D9D9' | 48 | | fill-color | String | 圆环内部填充色 | | 'none' | 49 | | speed | Number | 缓动速度(单位 ms) | | 500 | 50 | | value | Number | 当前百分比 | | 0 | 51 | 52 | ## Slots 53 | 54 | | name | 描述 | 55 | | :----: | :-----: | 56 | | - | 圆环中部内容 | 57 | -------------------------------------------------------------------------------- /packages/docs/markdown/v2/header.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Header 3 | keywords: 'we-vue, header' 4 | description: '' 5 | demo_url: //demo.wevue.org/header 6 | --- 7 | 8 | Header 9 | 10 | 页头。 11 | 12 | ## 引入 13 | 14 | ```js 15 | import { Header } from 'we-vue' 16 | 17 | Vue.use(Header) 18 | ``` 19 | 20 | ## 例子 21 | 22 | ### 默认 23 | 24 | ```html 25 | 26 | 27 | ``` 28 | 29 | ### 不固定并指定背景色 30 | ```html 31 | 32 |
33 | 34 |
35 |
36 | 37 |
38 |
39 | ``` 40 | 41 | ## API 42 | 43 | | 参数 | 类型 | 说明 | 可选值 | 默认值 | 44 | | :--------: | :-----: | :-----: | :------------------: | :-----: | 45 | | title | String | 标题 | | | 46 | | fixed | Boolean | 是否固定 | | true | 47 | | background-color | String | 背景色 | | '#21292c' | 48 | 49 | ## Slots 50 | 51 | | name | 描述 | 52 | | :----: | :-----: | 53 | | left | 左侧按钮位 | 54 | | right | 右侧按钮位 | 55 | -------------------------------------------------------------------------------- /packages/docs/markdown/v2/icon.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Icon 3 | keywords: 'we-vue, icon' 4 | description: '' 5 | demo_url: //demo.wevue.org/icon 6 | --- 7 | 8 | Icon 9 | 10 | 图标。 11 | 12 | ## 引入 13 | 14 | ```js 15 | import { Icon } from 'we-vue' 16 | 17 | Vue.use(Icon) 18 | ``` 19 | 20 | ## 例子 21 | 22 | ### 大图标 23 | 24 | ```html 25 | 26 | ``` 27 | 28 | ### 小图标 29 | 30 | ```html 31 | 32 | ``` 33 | 34 | ## API 35 | 36 | | 参数 | 类型 | 说明 | 可选值 | 默认值 | 37 | | :----: | :-----: | :----: | :--: | :---: | 38 | | type `(required)` | String | 图标类型 | 'success', 'info', 'warn', 'waiting', 'success-no-circle', 'circle', 'info-circle', 'download', 'cancel', 'search' | | 39 | | large | Boolean | 是否为大图标 | | false | 40 | 41 | -------------------------------------------------------------------------------- /packages/docs/markdown/v2/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Index 3 | keywords: 'we-vue, index' 4 | description: '' 5 | demo_url: //demo.wevue.org/ 6 | --- 7 | 8 | 文档 9 | 10 | 11 | 欢迎使用 we-vue! 12 | 13 | :::danger 14 | 右侧示例仅针对最新版本,其中部分涉及滑动、拖拽操作的示例请在触屏设备上预览,或使用浏览器模拟触屏设置进行查看。 15 | ::: 16 | 17 | ## 安装 18 | 19 | ```bash 20 | // npm 21 | $ npm install we-vue --save 22 | 23 | // yarn 24 | $ yarn add we-vue 25 | ``` 26 | 27 | ## 关于事件绑定 28 | 29 | 在 Vue 2.x 中,为自定义组件绑定原生事件必须使用 `.native` 修饰符: 30 | 31 | ```html 32 | Click Me 33 | ``` 34 | 35 | 从易用性的角度出发,我们对 Button 组件进行了处理,使它可以监听 click 事件: 36 | 37 | ```html 38 | Click Me 39 | ``` 40 | 41 | 对于其他组件,还是需要添加 .native 修饰符。 42 | 43 | ## 特别声明 44 | 45 | we-vue 参考了饿了么前端团队 [Mint-UI](http://mint-ui.github.io/#!/zh-cn) 项目的大量代码,可以说 we-vue 在一定程度上可以算是换上了 weui 皮肤的 Mint-UI,此前本人也就版权等问题联系相关作者,并得到回复“Mint-UI 使用 MIT 开源协议,可自由使用,但请注明版权”。由于代码作了很多调整,未及一一详细注明,为此在这里特别声明。感谢饿了么团队的优秀成果,以及他们所提供了 cooking-cli 脚手架工具为项目开发带来的便利。 46 | -------------------------------------------------------------------------------- /packages/docs/markdown/v2/lazyload.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Lazyload 3 | keywords: 'we-vue, lazyload' 4 | description: '' 5 | demo_url: //demo.wevue.org/lazyload 6 | --- 7 | 8 | Lazyload 9 | 10 | 11 | 图片懒加载。 12 | 13 | ## 引入 14 | 15 | ```js 16 | import { Lazyload } from 'we-vue' 17 | 18 | Vue.use(Lazyload) 19 | ``` 20 | 21 | ## 例子 22 | 23 | ### 基本示例 24 | 25 | ```html 26 | 35 | 36 | 52 | ``` 53 | -------------------------------------------------------------------------------- /packages/docs/markdown/v2/loadmore.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Loadmore 3 | keywords: 'we-vue, loadmore' 4 | description: '' 5 | demo_url: //demo.wevue.org/loadmore 6 | --- 7 | 8 | Loadmore 9 | 10 | 加载更多。 11 | 12 | ## 引入 13 | 14 | ```js 15 | import { Loadmore } from 'we-vue' 16 | 17 | Vue.use(Loadmore) 18 | ``` 19 | 20 | ## 例子 21 | 22 | ### 基本示例 23 | 24 | ```html 25 | 26 | ``` 27 | 28 | ### 指定文字 29 | 30 | ```html 31 | 32 | ``` 33 | 34 | ### 点划线 35 | 36 | ```html 37 | 38 | ``` 39 | 40 | ## API 41 | 42 | | 参数 | 类型 | 说明 | 可选值 | 默认值 | 43 | | :----: | :-----: | :----: | :--: | :---: | 44 | | type | String | 类型 | 'default', 'lineDot' | 'default' | 45 | | text | String | 文字 | | | 46 | -------------------------------------------------------------------------------- /packages/docs/markdown/v2/progress.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Progress 3 | keywords: 'we-vue, progress' 4 | description: '' 5 | demo_url: //demo.wevue.org/progress 6 | --- 7 | 8 | Progress 9 | 10 | 进度条。 11 | 12 | ## 引入 13 | 14 | ```js 15 | import { Progress } from 'we-vue' 16 | 17 | Vue.use(Progress) 18 | ``` 19 | 20 | ## 例子 21 | 22 | ### 默认 23 | 24 | ```html 25 | 26 | ``` 27 | 28 | ### 隐藏取消按钮 29 | 30 | ```html 31 | 32 | ``` 33 | 34 | ## API 35 | 36 | | 参数 | 类型 | 说明 | 可选值 | 默认值 | 37 | | :----: | :-----: | :----: | :--: | :---: | 38 | | percent | Number/String | 百分比值 | | | 39 | | show-clear | Boolean | 显示清除按钮 | | true | 40 | 41 | 42 | ## Events 43 | 44 | | 事件名 | 说明 | 参数 | 45 | | :----: | :-----: | :----: | 46 | | cancel | cancel 按钮点击事件 | 当前组件 | 47 | -------------------------------------------------------------------------------- /packages/docs/markdown/v2/slider.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Slider 3 | keywords: 'we-vue, slider' 4 | description: '' 5 | demo_url: //demo.wevue.org/slider 6 | --- 7 | 8 | Slider 9 | 10 | 滑块。 11 | 12 | ## 引入 13 | 14 | ```js 15 | import { Slider } from 'we-vue' 16 | 17 | Vue.use(Slider) 18 | ``` 19 | 20 | ## 例子 21 | 22 | ### 基本示例 23 | 24 | ```html 25 | 26 | ``` 27 | 28 | ### 不显示当前数值 29 | 30 | ```html 31 | 32 | ``` 33 | 34 | ### 禁用 35 | 36 | ```html 37 | 38 | ``` 39 | 40 | ## API 41 | 42 | | 参数 | 类型 | 说明 | 可选值 | 默认值 | 43 | | :----: | :-----: | :----: | :--: | :---: | 44 | | min | Number | 最小值 | | 0 | 45 | | max | Number | 最大值 | | 100 | 46 | | step | Number | 步进值 | | 1 | 47 | | show-value | Boolean | 是否显示右侧当前值文字 | | true | 48 | | enable-click | Boolean | 是否启用点击操作 | | true | 49 | | disabled | Boolean | 是否禁用 | | false | 50 | -------------------------------------------------------------------------------- /packages/docs/markdown/v2/switch.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Switch 3 | keywords: 'we-vue, switch' 4 | description: '' 5 | demo_url: //demo.wevue.org/switch 6 | --- 7 | 8 | Switch 9 | 10 | 开关。 11 | 12 | ## 引入 13 | 14 | ```js 15 | import { Switch } from 'we-vue' 16 | 17 | Vue.use(Switch) 18 | ``` 19 | 20 | ## 例子 21 | 22 | ### 默认 23 | 24 | ```html 25 | 26 | ``` 27 | 28 | ### 禁用 29 | 30 | ```html 31 | 32 | ``` 33 | 34 | ### 非列表项中的开关(即独立开关) 35 | 36 | ```html 37 | 38 | ``` 39 | 40 | ## API 41 | 42 | | 参数 | 类型 | 说明 | 可选值 | 默认值 | 43 | | :----: | :-----: | :----: | :--: | :---: | 44 | | title | String | 标题 | | | 45 | | is-in-cell | Boolean | 是否为列表项中的开关 | | true | 46 | | disabled | Boolean | 是否禁用 | | false | 47 | -------------------------------------------------------------------------------- /packages/docs/markdown/v2/toast.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Toast 3 | keywords: 'we-vue, toast' 4 | description: '' 5 | demo_url: //demo.wevue.org/toast 6 | --- 7 | 8 | Toast 9 | 10 | 弹出提示。 11 | 12 | ## 引入 13 | 14 | ```js 15 | import { Toast } from 'we-vue' 16 | ``` 17 | 18 | ## 例子 19 | 20 | ### 基本示例 21 | 22 | ```js 23 | Toast.success('操作成功'); 24 | Toast.fail('操作失败'); 25 | ``` 26 | 27 | ### 设置显示时长 28 | 29 | ```js 30 | Toast.fail({ 31 | duration: 1000, 32 | message: '操作失败' 33 | }) 34 | ``` 35 | 36 | ### 纯文本提示 37 | 38 | ```js 39 | Toast.text({ 40 | duration: 1000, 41 | message: '操作失败' 42 | }) 43 | ``` 44 | 45 | ### 加载提示 46 | 47 | ```js 48 | Toast.loading('laoding') 49 | ``` 50 | 51 | ## API 52 | 53 | | 参数 | 类型 | 说明 | 可选值 | 默认值 | 54 | | :----: | :-----: | :----: | :--: | :---: | 55 | | icon | String | 图标类型 | | 'success-no-circle' | 56 | | message | String | 提示文字 | | | 57 | | duration | Number | 提示时间(毫秒) | | | 58 | -------------------------------------------------------------------------------- /packages/docs/markdown/v2/top-tips.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: TopTips 3 | keywords: 'we-vue, top-tips' 4 | description: '' 5 | demo_url: //demo.wevue.org/top-tips 6 | --- 7 | 8 | TopTips 9 | 10 | 顶部提示条。 11 | 12 | ## 引入 13 | 14 | ```js 15 | import { TopTips } from 'we-vue' 16 | ``` 17 | 18 | ## 例子 19 | 20 | ```js 21 | // 传入字符串 22 | TopTips('提示信息') 23 | 24 | // 传入对象 25 | TopTips({ 26 | message: '提示信息', 27 | duration: 5000 28 | }) 29 | 30 | // 关闭 31 | TopTips.close() 32 | ``` 33 | 34 | ## API 35 | 36 | | 参数 | 类型 | 说明 | 可选值 | 默认值 | 37 | | :----: | :-----: | :----: | :--: | :---: | 38 | | message | String | 提示文字 | | | 39 | | duration | Number | 提示时间(毫秒) | | 3000 | 40 | -------------------------------------------------------------------------------- /packages/docs/markdown/v3/area-picker.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: AreaPicker 3 | keywords: 'we-vue, area-picker' 4 | description: '' 5 | demo_url: //demo.wevue.org/area-picker 6 | --- 7 | 8 | Picker 9 | 10 | 中国省市区选择器。 11 | 12 | **完善中...** 13 | -------------------------------------------------------------------------------- /packages/docs/markdown/v3/badge.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Badge 3 | keywords: 'we-vue, badge' 4 | description: '' 5 | demo_url: //demo.wevue.org/badge 6 | --- 7 | 8 | Badge 9 | 10 | 小徽章。 11 | 12 | ## 引入 13 | 14 | ```js 15 | import { Badge } from 'we-vue' 16 | 17 | Vue.use(Badge) 18 | ``` 19 | 20 | ## 例子 21 | 22 | ### 基本使用 23 | 24 | ```html 25 | 20 26 | ``` 27 | 28 | ### 指定背景色 29 | 30 | ```html 31 | 20 32 | ``` 33 | 34 | ### 指定为小红点样式 35 | 36 | ```html 37 | 38 | ``` 39 | 40 | ## API 41 | 42 | | 参数 | 类型 | 说明 | 可选值 | 默认值 | 43 | | :----: | :-----: | :----: | :--: | :---: | 44 | | color | String | 背景色 | | | 45 | | is-dot | Boolean | 是否是为红点 | | false | 46 | -------------------------------------------------------------------------------- /packages/docs/markdown/v3/circle.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Circle 3 | keywords: 'we-vue, circle' 4 | description: '' 5 | demo_url: //demo.wevue.org/circle 6 | --- 7 | 8 | Circle 9 | 10 | 环形进度指示。 11 | 12 | ## 引入 13 | 14 | ```js 15 | import { Circle } from 'we-vue' 16 | 17 | Vue.use(Circle) 18 | ``` 19 | 20 | ## 例子 21 | 22 | ### 指定线宽 23 | 24 | ```html 25 | 12 % 26 | ``` 27 | 28 | ### 指定填充色 29 | 30 | ```html 31 | 12 % 32 | ``` 33 | 34 | ### 指定直径 35 | 36 | ```html 37 | {{ sliderValue }}% 38 | ``` 39 | 40 | ## API 41 | 42 | | 参数 | 类型 | 说明 | 可选值 | 默认值 | 43 | | :----: | :-----: | :----: | :--: | :---: | 44 | | diameter | Number | 圆环直径 | | 100 | 45 | | line-width | Number | 线宽 | | 4 | 46 | | stroke-color | String | 主色 | | '#3FC7FA' | 47 | | trail-color | String | 轨道色 | | '#D9D9D9' | 48 | | fill-color | String | 圆环内部填充色 | | 'none' | 49 | | speed | Number | 缓动速度(单位 ms) | | 500 | 50 | | value | Number | 当前百分比 | | 0 | 51 | 52 | ## Slots 53 | 54 | | name | 描述 | 55 | | :----: | :-----: | 56 | | - | 圆环中部内容 | 57 | -------------------------------------------------------------------------------- /packages/docs/markdown/v3/header.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Header 3 | keywords: 'we-vue, header' 4 | description: '' 5 | demo_url: //demo.wevue.org/header 6 | --- 7 | 8 | Header 9 | 10 | 页头。 11 | 12 | ## 引入 13 | 14 | ```js 15 | import { Header } from 'we-vue' 16 | 17 | Vue.use(Header) 18 | ``` 19 | 20 | ## 例子 21 | 22 | ### 默认 23 | 24 | ```html 25 | 26 | 27 | ``` 28 | 29 | ### 不固定并指定背景色 30 | ```html 31 | 32 |
33 | 34 |
35 |
36 | 37 |
38 |
39 | ``` 40 | 41 | ## API 42 | 43 | | 参数 | 类型 | 说明 | 可选值 | 默认值 | 44 | | :--------: | :-----: | :-----: | :------------------: | :-----: | 45 | | title | String | 标题 | | | 46 | | fixed | Boolean | 是否固定 | | true | 47 | | background-color | String | 背景色 | | '#21292c' | 48 | 49 | ## Slots 50 | 51 | | name | 描述 | 52 | | :----: | :-----: | 53 | | left | 左侧按钮位 | 54 | | right | 右侧按钮位 | 55 | -------------------------------------------------------------------------------- /packages/docs/markdown/v3/icon.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Icon 3 | keywords: 'we-vue, icon' 4 | description: '' 5 | demo_url: //demo.wevue.org/icon 6 | --- 7 | 8 | Icon 9 | 10 | 图标。 11 | 12 | ## 引入 13 | 14 | ```js 15 | import { Icon } from 'we-vue' 16 | 17 | Vue.use(Icon) 18 | ``` 19 | 20 | ## 例子 21 | 22 | ### 大图标 23 | 24 | ```html 25 | 26 | ``` 27 | 28 | ### 小图标 29 | 30 | ```html 31 | 32 | ``` 33 | 34 | ## API 35 | 36 | | 参数 | 类型 | 说明 | 可选值 | 默认值 | 37 | | :----: | :-----: | :----: | :--: | :---: | 38 | | type `(required)` | String | 图标类型 | 'success', 'info', 'warn', 'waiting', 'success-no-circle', 'circle', 'info-circle', 'download', 'cancel', 'search' | | 39 | | large | Boolean | 是否为大图标 | | false | 40 | 41 | -------------------------------------------------------------------------------- /packages/docs/markdown/v3/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Index 3 | keywords: 'we-vue, index' 4 | description: '' 5 | demo_url: //demo.wevue.org/ 6 | --- 7 | 8 | 文档 9 | 10 | 欢迎使用 we-vue! 11 | 12 | :::danger 13 | 右侧示例仅针对最新版本,其中部分涉及滑动、拖拽操作的示例请在触屏设备上预览,或使用浏览器模拟触屏设置进行查看。 14 | ::: 15 | 16 | ## 安装 17 | 18 | ```bash 19 | // npm 20 | $ npm install we-vue --save 21 | 22 | // yarn 23 | $ yarn add we-vue 24 | ``` 25 | 26 | ## 关于事件绑定 27 | 28 | 在 Vue 2.x 中,为自定义组件绑定原生事件必须使用 `.native` 修饰符: 29 | 30 | ```html 31 | Click Me 32 | ``` 33 | 34 | 从易用性的角度出发,我们对 Button 组件进行了处理,使它可以监听 click 事件: 35 | 36 | ```html 37 | Click Me 38 | ``` 39 | 40 | 对于其他组件,还是需要添加 .native 修饰符。 41 | 42 | ## 特别声明 43 | 44 | 本项目参考了以下项目,部分代码移植于这些开源项目,但尚未及一一标注。在此对这些项目表示感谢。 45 | 46 | - [Vuetify](https://github.com/vuetifyjs/vuetify) 47 | - [Vant](https://github.com/youzan/vant) 48 | - [Mint-UI](http://mint-ui.github.io/#!/zh-cn) 49 | -------------------------------------------------------------------------------- /packages/docs/markdown/v3/lazyload.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Lazyload 3 | keywords: 'we-vue, lazyload' 4 | description: '' 5 | demo_url: //demo.wevue.org/lazyload 6 | --- 7 | 8 | Lazyload 9 | 10 | 图片懒加载。 11 | 12 | ## 引入 13 | 14 | ```js 15 | import { Lazyload } from 'we-vue' 16 | 17 | Vue.use(Lazyload) 18 | ``` 19 | 20 | ## 例子 21 | 22 | ### 基本示例 23 | 24 | ```html 25 | 34 | 35 | 51 | ``` 52 | -------------------------------------------------------------------------------- /packages/docs/markdown/v3/loadmore.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Loadmore 3 | keywords: 'we-vue, loadmore' 4 | description: '' 5 | demo_url: //demo.wevue.org/loadmore 6 | --- 7 | 8 | Loadmore 9 | 10 | 加载更多。 11 | 12 | ## 引入 13 | 14 | ```js 15 | import { Loadmore } from 'we-vue' 16 | 17 | Vue.use(Loadmore) 18 | ``` 19 | 20 | ## 例子 21 | 22 | ### 基本示例 23 | 24 | ```html 25 | 26 | ``` 27 | 28 | ### 指定文字 29 | 30 | ```html 31 | 32 | ``` 33 | 34 | ### 点划线 35 | 36 | ```html 37 | 38 | ``` 39 | 40 | ## API 41 | 42 | | 参数 | 类型 | 说明 | 可选值 | 默认值 | 43 | | :----: | :-----: | :----: | :--: | :---: | 44 | | type | String | 类型 | 'default', 'lineDot' | 'default' | 45 | | text | String | 文字 | | | 46 | -------------------------------------------------------------------------------- /packages/docs/markdown/v3/progress.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Progress 3 | keywords: 'we-vue, progress' 4 | description: '' 5 | demo_url: //demo.wevue.org/progress 6 | --- 7 | 8 | Progress 9 | 10 | 进度条。 11 | 12 | ## 引入 13 | 14 | ```js 15 | import { Progress } from 'we-vue' 16 | 17 | Vue.use(Progress) 18 | ``` 19 | 20 | ## 例子 21 | 22 | ### 默认 23 | 24 | ```html 25 | 26 | ``` 27 | 28 | ### 隐藏取消按钮 29 | 30 | ```html 31 | 32 | ``` 33 | 34 | ## API 35 | 36 | | 参数 | 类型 | 说明 | 可选值 | 默认值 | 37 | | :----: | :-----: | :----: | :--: | :---: | 38 | | percent | Number/String | 百分比值 | | | 39 | | show-clear | Boolean | 显示清除按钮 | | true | 40 | 41 | 42 | ## Events 43 | 44 | | 事件名 | 说明 | 参数 | 45 | | :----: | :-----: | :----: | 46 | | cancel | cancel 按钮点击事件 | 当前组件 | 47 | -------------------------------------------------------------------------------- /packages/docs/markdown/v3/slider.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Slider 3 | keywords: 'we-vue, slider' 4 | description: '' 5 | demo_url: //demo.wevue.org/slider 6 | --- 7 | 8 | Slider 9 | 10 | 滑块。 11 | 12 | ## 引入 13 | 14 | ```js 15 | import { Slider } from 'we-vue' 16 | 17 | Vue.use(Slider) 18 | ``` 19 | 20 | ## 例子 21 | 22 | ### 基本示例 23 | 24 | ```html 25 | 26 | ``` 27 | 28 | ### 不显示当前数值 29 | 30 | ```html 31 | 32 | ``` 33 | 34 | ### 禁用 35 | 36 | ```html 37 | 38 | ``` 39 | 40 | ## API 41 | 42 | | 参数 | 类型 | 说明 | 可选值 | 默认值 | 43 | | :----: | :-----: | :----: | :--: | :---: | 44 | | min | Number | 最小值 | | 0 | 45 | | max | Number | 最大值 | | 100 | 46 | | step | Number | 步进值 | | 1 | 47 | | show-value | Boolean | 是否显示右侧当前值文字 | | true | 48 | | enable-click | Boolean | 是否启用点击操作 | | true | 49 | | disabled | Boolean | 是否禁用 | | false | 50 | -------------------------------------------------------------------------------- /packages/docs/markdown/v3/switch-cell.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: SwitchCell 3 | keywords: 'we-vue, switch-cell' 4 | description: '' 5 | demo_url: //demo.wevue.org/switch-cell 6 | --- 7 | 8 | Switch 9 | 10 | 开关。 11 | 12 | ## 引入 13 | 14 | ```js 15 | import { Switch } from 'we-vue' 16 | 17 | Vue.use(Switch) 18 | ``` 19 | 20 | ## 例子 21 | 22 | ### 默认 23 | 24 | ```html 25 | 26 | ``` 27 | 28 | ### 禁用 29 | 30 | ```html 31 | 32 | ``` 33 | 34 | ### 非列表项中的开关(即独立开关) 35 | 36 | ```html 37 | 38 | ``` 39 | 40 | ## API 41 | 42 | | 参数 | 类型 | 说明 | 可选值 | 默认值 | 43 | | :----: | :-----: | :----: | :--: | :---: | 44 | | title | String | 标题 | | | 45 | | is-in-cell | Boolean | 是否为列表项中的开关 | | true | 46 | | disabled | Boolean | 是否禁用 | | false | 47 | -------------------------------------------------------------------------------- /packages/docs/markdown/v3/switch.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Switch 3 | keywords: 'we-vue, switch' 4 | description: '' 5 | demo_url: //demo.wevue.org/switch 6 | --- 7 | 8 | Switch 9 | 10 | 开关。 11 | 12 | ## 引入 13 | 14 | ```js 15 | import { Switch } from 'we-vue' 16 | 17 | Vue.use(Switch) 18 | ``` 19 | 20 | ## 例子 21 | 22 | ### 默认 23 | 24 | ```html 25 | 26 | ``` 27 | 28 | ### 禁用 29 | 30 | ```html 31 | 32 | ``` 33 | 34 | ### 非列表项中的开关(即独立开关) 35 | 36 | ```html 37 | 38 | ``` 39 | 40 | ## API 41 | 42 | | 参数 | 类型 | 说明 | 可选值 | 默认值 | 43 | | :----: | :-----: | :----: | :--: | :---: | 44 | | title | String | 标题 | | | 45 | | is-in-cell | Boolean | 是否为列表项中的开关 | | true | 46 | | disabled | Boolean | 是否禁用 | | false | 47 | -------------------------------------------------------------------------------- /packages/docs/markdown/v3/textarea.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Textarea 3 | keywords: 'we-vue, textarea' 4 | description: '' 5 | demo_url: //demo.wevue.org/textarea 6 | --- 7 | 8 | Textarea 9 | 10 | 文本框。 11 | 12 | ## 引入 13 | 14 | ```js 15 | import { Textarea } from 'we-vue' 16 | 17 | Vue.use(Textarea) 18 | ``` 19 | 20 | :::warning 21 | textarea 只能在 group 中使用。 22 | ::: 23 | 24 | ## 例子 25 | 26 | ### 基本示例 27 | 28 | ```html 29 | 30 | 31 | 32 | ``` 33 | 34 | ### 自定义字数限制 35 | 36 | ```html 37 | 38 | 39 | 40 | ``` 41 | 42 | ### 不显示字数提示 43 | 44 | ```html 45 | 46 | 47 | 48 | ``` 49 | 50 | ## API 51 | 52 | | 参数 | 类型 | 说明 | 可选值 | 默认值 | 53 | | :----: | :-----: | :----: | :--: | :---: | 54 | | placeholder | String | 占位提示 | | | 55 | | rows | Number | 行数 | | 3 | 56 | | max-length | Number/String | 最大字数 | | 100 | 57 | | show-counter | Boolean | 是否显示字数提示 | | true | 58 | | disabled | Boolean | 是否禁用 | | false | 59 | | readonly | Boolean | 是否只读 | | false | 60 | -------------------------------------------------------------------------------- /packages/docs/markdown/v3/toast.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Toast 3 | keywords: 'we-vue, toast' 4 | description: '' 5 | demo_url: //demo.wevue.org/toast 6 | --- 7 | 8 | Toast 9 | 10 | 弹出提示。 11 | 12 | ## 引入 13 | 14 | ```js 15 | import { Toast } from 'we-vue' 16 | ``` 17 | 18 | ## 例子 19 | 20 | ### 基本示例 21 | 22 | ```js 23 | Toast.success('操作成功'); 24 | Toast.fail('操作失败'); 25 | ``` 26 | 27 | ### 设置显示时长 28 | 29 | ```js 30 | Toast.fail({ 31 | duration: 1000, 32 | message: '操作失败' 33 | }) 34 | ``` 35 | 36 | ### 纯文本提示 37 | 38 | ```js 39 | Toast.text({ 40 | duration: 1000, 41 | message: '操作失败' 42 | }) 43 | ``` 44 | 45 | ### 加载提示 46 | 47 | ```js 48 | Toast.loading('laoding') 49 | ``` 50 | 51 | ## API 52 | 53 | | 参数 | 类型 | 说明 | 可选值 | 默认值 | 54 | | :----: | :-----: | :----: | :--: | :---: | 55 | | icon | String | 图标类型 | | 'success-no-circle' | 56 | | message | String | 提示文字 | | | 57 | | duration | Number | 提示时间(毫秒) | | | 58 | -------------------------------------------------------------------------------- /packages/docs/markdown/v3/top-tips.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: TopTips 3 | keywords: 'we-vue, top-tips' 4 | description: '' 5 | demo_url: //demo.wevue.org/top-tips 6 | --- 7 | 8 | TopTips 9 | 10 | 顶部提示条。 11 | 12 | ## 引入 13 | 14 | ```js 15 | import { TopTips } from 'we-vue' 16 | ``` 17 | 18 | ## 例子 19 | 20 | ```js 21 | // 传入字符串 22 | TopTips('提示信息') 23 | 24 | // 传入对象 25 | TopTips({ 26 | message: '提示信息', 27 | duration: 5000 28 | }) 29 | 30 | // 关闭 31 | TopTips.close() 32 | ``` 33 | 34 | ## API 35 | 36 | | 参数 | 类型 | 说明 | 可选值 | 默认值 | 37 | | :----: | :-----: | :----: | :--: | :---: | 38 | | message | String | 提示文字 | | | 39 | | duration | Number | 提示时间(毫秒) | | 3000 | 40 | -------------------------------------------------------------------------------- /packages/docs/middleware/README.md: -------------------------------------------------------------------------------- 1 | # MIDDLEWARE 2 | 3 | **This directory is not required, you can delete it if you don't want to use it.** 4 | 5 | This directory contains your application middleware. 6 | Middleware let you define custom functions that can be run before rendering either a page or a group of pages. 7 | 8 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/routing#middleware). 9 | -------------------------------------------------------------------------------- /packages/docs/plugins/README.md: -------------------------------------------------------------------------------- 1 | # PLUGINS 2 | 3 | **This directory is not required, you can delete it if you don't want to use it.** 4 | 5 | This directory contains Javascript plugins that you want to run before mounting the root Vue.js application. 6 | 7 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/plugins). 8 | -------------------------------------------------------------------------------- /packages/docs/static/README.md: -------------------------------------------------------------------------------- 1 | # STATIC 2 | 3 | **This directory is not required, you can delete it if you don't want to use it.** 4 | 5 | This directory contains your static files. 6 | Each file inside this directory is mapped to `/`. 7 | Thus you'd want to delete this README.md before deploying to production. 8 | 9 | Example: `/static/robots.txt` is mapped as `/robots.txt`. 10 | 11 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/assets#static). 12 | -------------------------------------------------------------------------------- /packages/docs/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/docs/static/favicon.ico -------------------------------------------------------------------------------- /packages/docs/static/images/demo_qrcode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/docs/static/images/demo_qrcode.png -------------------------------------------------------------------------------- /packages/docs/static/images/easy-to-use.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/docs/static/images/easy-to-use.jpg -------------------------------------------------------------------------------- /packages/docs/static/images/full-document.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/docs/static/images/full-document.jpg -------------------------------------------------------------------------------- /packages/docs/static/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/docs/static/images/logo.png -------------------------------------------------------------------------------- /packages/docs/static/images/online-demo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/docs/static/images/online-demo.jpg -------------------------------------------------------------------------------- /packages/docs/static/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /packages/docs/static/svg/icon_search.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /packages/docs/store/index.ts: -------------------------------------------------------------------------------- 1 | // import { Store } from 'vuex' 2 | 3 | type Theme = 'light' | 'dark' 4 | 5 | export const state = () => ({ 6 | locales: ['en', 'zh-cn'], 7 | locale: 'en', 8 | theme: 'light', 9 | }) 10 | 11 | export const mutations = { 12 | SET_LANG(state, locale: string): void { 13 | if (state.locales.includes(locale)) { 14 | state.locale = locale 15 | } 16 | }, 17 | 18 | SET_THEME(state, theme: Theme): void { 19 | state.theme = theme 20 | }, 21 | } 22 | -------------------------------------------------------------------------------- /packages/docs/test/Logo.spec.js: -------------------------------------------------------------------------------- 1 | import { mount } from '@vue/test-utils' 2 | import Logo from '@/components/Logo.vue' 3 | 4 | describe('Logo', () => { 5 | test('is a Vue instance', () => { 6 | const wrapper = mount(Logo) 7 | expect(wrapper.isVueInstance()).toBeTruthy() 8 | }) 9 | }) 10 | -------------------------------------------------------------------------------- /packages/docs/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "esnext", 4 | "module": "esnext", 5 | "moduleResolution": "node", 6 | "resolveJsonModule": true, 7 | "lib": [ 8 | "esnext", 9 | "esnext.asynciterable", 10 | "dom" 11 | ], 12 | "esModuleInterop": true, 13 | "experimentalDecorators": true, 14 | "allowJs": true, 15 | "sourceMap": true, 16 | "strict": true, 17 | "noImplicitAny": false, 18 | "noEmit": true, 19 | "baseUrl": ".", 20 | "paths": { 21 | "~/*": [ 22 | "./*" 23 | ], 24 | "@/*": [ 25 | "./*" 26 | ] 27 | }, 28 | "types": [ 29 | "@types/node", 30 | "@nuxt/types" 31 | ] 32 | }, 33 | "files": [ 34 | "global.d.ts", 35 | "shims-vue.d.ts" 36 | ] 37 | } 38 | -------------------------------------------------------------------------------- /packages/docs/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "defaultSeverity": "error", 3 | "extends": "typestrict", 4 | "linterOptions": { 5 | "exclude": [ 6 | "**/*.spec.js", 7 | "**/node_modules/**/*" 8 | ] 9 | }, 10 | "jsRules": {}, 11 | "rules": { 12 | // IMPOTRANT: enforces use of T[] if T is a simple type (primitive or type reference). 13 | "array-type": [true, "array-simple"], 14 | "use-type-alias": true, 15 | "no-inferrable-types": true, 16 | "unified-signatures": true, 17 | "no-undefined-argument": true, 18 | "use-default-type-parameter": true, 19 | 20 | /* typestrict overrides */ 21 | 22 | // Handled by tsc 23 | "no-unused-variable": false, 24 | 25 | // Useless with vue 26 | "no-invalid-this": false, 27 | 28 | // Retarded 29 | "restrict-plus-operands": false, 30 | 31 | // Fails with no-unused-variable for some reason 32 | "no-useless-cast": false, 33 | 34 | "no-floating-promises": false 35 | }, 36 | "rulesDirectory": [] 37 | } 38 | -------------------------------------------------------------------------------- /packages/we-vue/.browserslistrc: -------------------------------------------------------------------------------- 1 | >0.5% 2 | last 2 versions 3 | not dead 4 | not op_mini all 5 | -------------------------------------------------------------------------------- /packages/we-vue/.eslintignore: -------------------------------------------------------------------------------- 1 | /node_modules/ 2 | /build/ 3 | /dist/ 4 | /es5 5 | /lib 6 | /lib-temp 7 | /*.js 8 | /test/unit/coverage/ 9 | -------------------------------------------------------------------------------- /packages/we-vue/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | 4 | # Built files 5 | /dist/ 6 | /es5/ 7 | /lib/ 8 | /lib-temp/ 9 | 10 | /test/unit/coverage/ 11 | -------------------------------------------------------------------------------- /packages/we-vue/.npmignore: -------------------------------------------------------------------------------- 1 | * 2 | 3 | # Keep source 4 | !/src/ 5 | 6 | ? Keep built files 7 | !/dist/ 8 | !/lib/ 9 | !/es5/ 10 | 11 | # Keep types 12 | !/types/*.d.ts 13 | -------------------------------------------------------------------------------- /packages/we-vue/.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | printWidth: 100, 3 | useTabs: false, 4 | tabWidth: 2, 5 | trailingComma: 'es5', 6 | semi: false, 7 | singleQuote: true, 8 | } 9 | -------------------------------------------------------------------------------- /packages/we-vue/build/build-lib.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Build npm lib 3 | */ 4 | 'use strict' 5 | const shell = require('shelljs') 6 | 7 | shell.rm('-rf', 'es5', 'lib', 'lib-temp') 8 | shell.exec('yarn run tsc -p tsconfig.dist.json') 9 | shell.exec('yarn run cross-env NODE_ENV=es5 babel lib-temp --out-dir es5 --source-maps -q') 10 | shell.mv('./lib-temp/entry-lib.js', './lib-temp/index.js') 11 | shell.exec('yarn run cross-env NODE_ENV=lib babel lib-temp --out-dir lib --source-maps -q') 12 | -------------------------------------------------------------------------------- /packages/we-vue/postcss.config.js: -------------------------------------------------------------------------------- 1 | const postimport = require('postcss-import') 2 | const posturl = require('postcss-url') 3 | const autoprefixer = require('autoprefixer') 4 | 5 | module.exports = ctx => ({ 6 | plugins: [ 7 | postimport(), 8 | posturl(), 9 | autoprefixer({}), 10 | ], 11 | }) 12 | -------------------------------------------------------------------------------- /packages/we-vue/src/assets/iconfont/iconfont.css: -------------------------------------------------------------------------------- 1 | 2 | @font-face {font-family: "iconfont"; 3 | src: url('iconfont.eot?t=1500577729042'); /* IE9*/ 4 | src: url('iconfont.eot?t=1500577729042#iefix') format('embedded-opentype'), /* IE6-IE8 */ 5 | url('iconfont.woff?t=1500577729042') format('woff'), /* chrome, firefox */ 6 | url('iconfont.ttf?t=1500577729042') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/ 7 | url('iconfont.svg?t=1500577729042#iconfont') format('svg'); /* iOS 4.1- */ 8 | } 9 | 10 | .iconfont { 11 | font-family:"iconfont" !important; 12 | font-size:16px; 13 | font-style:normal; 14 | -webkit-font-smoothing: antialiased; 15 | -moz-osx-font-smoothing: grayscale; 16 | } 17 | 18 | .icon-spinner9:before { content: "\e7e9"; } 19 | 20 | .icon-spinner-1:before { content: "\e722"; } 21 | 22 | .icon-spinner1:before { content: "\e806"; } 23 | 24 | .icon-spinner2:before { content: "\e63f"; } 25 | 26 | -------------------------------------------------------------------------------- /packages/we-vue/src/assets/iconfont/iconfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/we-vue/src/assets/iconfont/iconfont.eot -------------------------------------------------------------------------------- /packages/we-vue/src/assets/iconfont/iconfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/we-vue/src/assets/iconfont/iconfont.ttf -------------------------------------------------------------------------------- /packages/we-vue/src/assets/iconfont/iconfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianyong90/we-vue/ec5c6bb7fa414cbbe25445ee8051872618224af6/packages/we-vue/src/assets/iconfont/iconfont.woff -------------------------------------------------------------------------------- /packages/we-vue/src/assets/loading-spin.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WActionsheet/__test__/__snapshots__/WActionsheet.spec.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`actionsheet create 1`] = ` 4 |
5 | 6 | 12 |
13 | `; 14 | 15 | exports[`actionsheet create 2`] = ` 16 | 22 | `; 23 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WActionsheet/index.ts: -------------------------------------------------------------------------------- 1 | import WActionsheet from './WActionsheet' 2 | 3 | export { WActionsheet } 4 | export default WActionsheet 5 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WAreaPicker/index.ts: -------------------------------------------------------------------------------- 1 | import WAreaPicker from './WAreaPicker' 2 | 3 | export { WAreaPicker } 4 | export default WAreaPicker 5 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WBadge/WBadge.tsx: -------------------------------------------------------------------------------- 1 | import '@/scss/badge.scss' 2 | import Vue, { VNode } from 'vue' 3 | 4 | export default Vue.extend({ 5 | name: 'w-badge', 6 | 7 | functional: true, 8 | 9 | props: { 10 | color: String, 11 | isDot: Boolean, 12 | }, 13 | 14 | render (h, context): VNode { 15 | const style = { 16 | backgroundColor: context.props.color, 17 | } 18 | 19 | return ( 20 | 28 | { !context.props.isDot && context.children } 29 | 30 | ) 31 | }, 32 | }) 33 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WBadge/__test__/WBadge.spec.ts: -------------------------------------------------------------------------------- 1 | import { shallowMount } from '@vue/test-utils' 2 | import Badge from '../' 3 | 4 | describe('badge', () => { 5 | test('create', () => { 6 | const wrapper = shallowMount(Badge, { 7 | propsData: {}, 8 | }) 9 | 10 | expect(wrapper.classes()).toContain('weui-badge') 11 | expect(wrapper.html()).toMatchSnapshot() 12 | }) 13 | 14 | test('is-dot', () => { 15 | const wrapper = shallowMount(Badge, { 16 | propsData: { 17 | isDot: true, 18 | }, 19 | }) 20 | 21 | expect(wrapper.classes()).toContain('weui-badge_dot') 22 | expect(wrapper.html()).toMatchSnapshot() 23 | }) 24 | }) 25 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WBadge/__test__/__snapshots__/WBadge.spec.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`badge create 1`] = ``; 4 | 5 | exports[`badge is-dot 1`] = ``; 6 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WBadge/index.ts: -------------------------------------------------------------------------------- 1 | import WBadge from './WBadge' 2 | 3 | export { WBadge } 4 | export default WBadge 5 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WButton/index.ts: -------------------------------------------------------------------------------- 1 | import WButton from './WButton' 2 | 3 | export { WButton } 4 | export default WButton 5 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WCell/WCell.tsx: -------------------------------------------------------------------------------- 1 | import '@/scss/cell.scss' 2 | 3 | import Routeable from '@/mixins/routable' 4 | 5 | import mixins from '@/utils/mixins' 6 | 7 | export default mixins( 8 | Routeable 9 | /* @vue/component */ 10 | ).extend({ 11 | name: 'w-cell', 12 | 13 | props: { 14 | title: { 15 | type: [String, Number], 16 | }, 17 | value: { 18 | type: [String, Number], 19 | }, 20 | isLink: Boolean, 21 | }, 22 | 23 | methods: { 24 | onClick () { 25 | this.$emit('click') 26 | this.routeLink() 27 | }, 28 | }, 29 | 30 | render () { 31 | return ( 32 |
39 |
40 | { this.$slots.icon } 41 |
42 |
43 | { this.$slots.bd ||

} 44 |

45 |
46 | { this.$slots.ft || this.value } 47 |
48 |
49 | ) 50 | }, 51 | }) 52 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WCell/__test__/WCell.spec.ts: -------------------------------------------------------------------------------- 1 | import { mount, shallowMount } from '@vue/test-utils' 2 | import Cell from '../' 3 | 4 | describe('cell', () => { 5 | test('create', () => { 6 | const wrapper = shallowMount(Cell, { 7 | propsData: {}, 8 | }) 9 | 10 | expect(wrapper.name()).toBe('w-cell') 11 | expect(wrapper.classes()).toContain('weui-cell') 12 | 13 | expect(wrapper).toMatchSnapshot() 14 | }) 15 | 16 | test('is-link', () => { 17 | const wrapper = shallowMount(Cell, { 18 | propsData: { 19 | isLink: true, 20 | }, 21 | }) 22 | 23 | expect(wrapper.classes()).toContain('weui-cell_access') 24 | 25 | expect(wrapper).toMatchSnapshot() 26 | }) 27 | 28 | test('handle click', () => { 29 | const routeLinkSpy = jest.fn() 30 | const wrapper = mount(Cell, { 31 | propsData: {}, 32 | methods: { 33 | routeLink: routeLinkSpy, 34 | }, 35 | }) 36 | 37 | wrapper.trigger('click') 38 | expect(wrapper.emitted().click).toBeTruthy() 39 | expect(routeLinkSpy).toHaveBeenCalled() 40 | 41 | expect(wrapper).toMatchSnapshot() 42 | }) 43 | }) 44 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WCell/__test__/__snapshots__/WCell.spec.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`cell create 1`] = ` 4 |
5 |
6 |
7 |

8 |
9 |
10 |
11 | `; 12 | 13 | exports[`cell handle click 1`] = ` 14 |
15 |
16 |
17 |

18 |
19 |
20 |
21 | `; 22 | 23 | exports[`cell is-link 1`] = ` 24 |
25 |
26 |
27 |

28 |
29 |
30 |
31 | `; 32 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WCell/index.ts: -------------------------------------------------------------------------------- 1 | import WCell from './WCell' 2 | 3 | export { WCell } 4 | export default WCell 5 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WChecklist/index.ts: -------------------------------------------------------------------------------- 1 | import WChecklist from './WChecklist' 2 | 3 | export { WChecklist } 4 | export default WChecklist 5 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WCircle/__test__/WCircle.spec.ts: -------------------------------------------------------------------------------- 1 | import { shallowMount } from '@vue/test-utils' 2 | import Circle from '../' 3 | 4 | describe('circle', () => { 5 | test('create', () => { 6 | const wrapper = shallowMount(Circle, { 7 | propsData: {}, 8 | }) 9 | 10 | expect(wrapper.name()).toBe('w-circle') 11 | expect(wrapper.classes()).toContain('wv-circle') 12 | 13 | expect(wrapper.html()).toMatchSnapshot() 14 | }) 15 | 16 | test('what value change', () => { 17 | const wrapper = shallowMount(Circle, { 18 | propsData: { 19 | value: 0, 20 | }, 21 | }) 22 | 23 | wrapper.setProps({ 24 | value: 100, 25 | }) 26 | 27 | expect(wrapper.vm.currentValue).toBe(100) 28 | }) 29 | 30 | test('what currentValue change', () => { 31 | const wrapper = shallowMount(Circle, { 32 | propsData: { 33 | value: 0, 34 | }, 35 | }) 36 | 37 | wrapper.setData({ 38 | currentValue: 100, 39 | }) 40 | 41 | expect(wrapper.emitted().input).toBeTruthy() 42 | }) 43 | }) 44 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WCircle/__test__/__snapshots__/WCircle.spec.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`circle create 1`] = ` 4 |
5 | 8 | 11 |
12 | `; 13 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WCircle/index.ts: -------------------------------------------------------------------------------- 1 | import WCircle from './WCircle' 2 | 3 | export { WCircle } 4 | export default WCircle 5 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WDatetimePicker/index.ts: -------------------------------------------------------------------------------- 1 | import WDatetimePicker from './WDatetimePicker' 2 | 3 | export { WDatetimePicker } 4 | export default WDatetimePicker 5 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WFlex/WFlex.ts: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import '@/scss/flex.scss' 3 | import { PropValidator } from 'vue/types/options' 4 | import { VNode } from 'vue/types/vnode' 5 | 6 | export default Vue.extend({ 7 | name: 'w-flex', 8 | 9 | provide (): object { 10 | return { flexComponent: this } 11 | }, 12 | 13 | props: { 14 | gutter: { 15 | type: [Number, String], 16 | default: 0, 17 | validator: (val: number | string) => { 18 | return Number(val) >= 0 19 | }, 20 | } as PropValidator, 21 | }, 22 | 23 | computed: { 24 | style (): object { 25 | const margin = `-${Number(this.gutter) / 2}px` 26 | 27 | return this.gutter ? { marginLeft: margin, marginRight: margin } : {} 28 | }, 29 | }, 30 | 31 | render (h): VNode { 32 | return h('div', { 33 | class: 'weui-flex', 34 | style: this.style, 35 | }, [ 36 | this.$slots.default, 37 | ]) 38 | }, 39 | }) 40 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WFlex/__test__/WFlex.spec.ts: -------------------------------------------------------------------------------- 1 | import { mount, shallowMount } from '@vue/test-utils' 2 | import Flex from '../' 3 | 4 | describe('flex', () => { 5 | test('create', () => { 6 | const wrapper = mount(Flex, { 7 | propsData: {}, 8 | }) 9 | 10 | expect(wrapper.name()).toBe('w-flex') 11 | expect(wrapper.classes()).toContain('weui-flex') 12 | 13 | expect(wrapper.html()).toMatchSnapshot() 14 | }) 15 | 16 | test('style should be computed correctly', () => { 17 | const wrapper = shallowMount(Flex, { 18 | propsData: { 19 | }, 20 | }) 21 | 22 | expect(wrapper.vm.style).toEqual({}) 23 | 24 | const gutterValue = 10 25 | 26 | wrapper.setProps({ 27 | gutter: gutterValue, 28 | }) 29 | 30 | expect(wrapper.vm.style).toEqual({ 31 | marginLeft: `-${gutterValue / 2}px`, 32 | marginRight: `-${gutterValue / 2}px`, 33 | }) 34 | 35 | expect(wrapper.html()).toMatchSnapshot() 36 | }) 37 | }) 38 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WFlex/__test__/__snapshots__/WFlex.spec.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`flex create 1`] = `
`; 4 | 5 | exports[`flex style should be computed correctly 1`] = `
`; 6 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WFlex/index.ts: -------------------------------------------------------------------------------- 1 | import WFlex from './WFlex' 2 | 3 | export { WFlex } 4 | export default WFlex 5 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WFlexItem/WFlexItem.ts: -------------------------------------------------------------------------------- 1 | import Vue, { VNode } from 'vue' 2 | 3 | import WFlex from '../WFlex' 4 | 5 | type WFlexInstance = InstanceType 6 | 7 | interface options extends Vue { 8 | flexComponent: WFlexInstance 9 | } 10 | 11 | export default Vue.extend().extend({ 12 | name: 'w-flex-item', 13 | 14 | inject: { 15 | flexComponent: { 16 | default: null, 17 | }, 18 | }, 19 | 20 | props: { 21 | flex: { 22 | type: [Number, String], 23 | default: 1, 24 | }, 25 | offset: { 26 | type: String, 27 | default: '', 28 | }, 29 | }, 30 | 31 | computed: { 32 | gutter (): number { 33 | return (Number(this.flexComponent.gutter)) || 0 34 | }, 35 | 36 | style (): object { 37 | const padding = `${Number(this.gutter) / 2}px` 38 | 39 | const ret = this.gutter 40 | ? { 41 | paddingLeft: padding, 42 | paddingRight: padding, 43 | } 44 | : {} 45 | 46 | return { ...ret, ...{ flex: Number(this.flex), marginLeft: this.offset } } 47 | }, 48 | }, 49 | 50 | render (h): VNode { 51 | return h('div', { 52 | class: 'weui-flex__item', 53 | style: this.style, 54 | }, [ 55 | this.$slots.default, 56 | ]) 57 | }, 58 | }) 59 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WFlexItem/__test__/__snapshots__/WFlexItem.spec.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`flex-item comput gutter 1`] = ` 4 |
5 |
6 |
7 | `; 8 | 9 | exports[`flex-item create 1`] = `
`; 10 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WFlexItem/index.ts: -------------------------------------------------------------------------------- 1 | import WFlexItem from './WFlexItem' 2 | 3 | export { WFlexItem } 4 | export default WFlexItem 5 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WFooter/WFooter.tsx: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import '@/scss/footer.scss' 3 | import WFooterLink from './WFooterLink' 4 | import { PropValidator } from 'vue/types/options' 5 | 6 | export default Vue.extend({ 7 | name: 'w-footer', 8 | 9 | props: { 10 | text: String, 11 | links: { 12 | type: Array, 13 | default: () => [], 14 | } as PropValidator, 15 | }, 16 | 17 | render () { 18 | const footerLinks = this.links.map(item => ( 19 | 24 | )) 25 | 26 | return ( 27 | 34 | ) 35 | }, 36 | }) 37 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WFooter/WFooterLink.ts: -------------------------------------------------------------------------------- 1 | import { VNode } from 'vue/types/vnode' 2 | 3 | import Routeable from '@/mixins/routable' 4 | 5 | import mixins from '@/utils/mixins' 6 | 7 | /* @vue/component */ 8 | export default mixins( 9 | Routeable 10 | ).extend({ 11 | name: 'w-footer-link', 12 | 13 | props: { 14 | text: String, 15 | }, 16 | 17 | methods: { 18 | onClick () { 19 | this.$emit('click') 20 | this.routeLink() 21 | }, 22 | }, 23 | 24 | render (h): VNode { 25 | return h('div', { 26 | class: 'weui-footer__link', 27 | on: { 28 | click: this.onClick, 29 | }, 30 | }, this.text) 31 | }, 32 | }) 33 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WFooter/__test__/WFooter.spec.ts: -------------------------------------------------------------------------------- 1 | import { mount, shallowMount } from '@vue/test-utils' 2 | import Footer from '../' 3 | 4 | describe('footer', () => { 5 | test('create', () => { 6 | const wrapper = shallowMount(Footer, { 7 | propsData: {}, 8 | }) 9 | 10 | expect(wrapper.name()).toBe('w-footer') 11 | expect(wrapper.classes()).toContain('weui-footer') 12 | 13 | expect(wrapper.html()).toMatchSnapshot() 14 | }) 15 | 16 | test('text', () => { 17 | const wrapper = shallowMount(Footer, { 18 | propsData: { 19 | text: 'test', 20 | }, 21 | }) 22 | 23 | expect(wrapper.contains('p.weui-footer__text')).toBeTruthy() 24 | expect(wrapper.find('p.weui-footer__text').text()).toBe('test') 25 | 26 | expect(wrapper.html()).toMatchSnapshot() 27 | }) 28 | 29 | test('render with links', () => { 30 | const wrapper = mount(Footer, { 31 | propsData: { 32 | text: 'test', 33 | links: [ 34 | { 35 | text: 'foo', 36 | link: 'bar', 37 | }, 38 | { 39 | text: 'foo', 40 | link: 'bar', 41 | }, 42 | ], 43 | }, 44 | }) 45 | 46 | expect(wrapper.findAll('.weui-footer__link')).toHaveLength(2) 47 | 48 | expect(wrapper.html()).toMatchSnapshot() 49 | }) 50 | }) 51 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WFooter/__test__/WFooterLink.spec.ts: -------------------------------------------------------------------------------- 1 | import { shallowMount } from '@vue/test-utils' 2 | import FooterLink from '../WFooterLink' 3 | 4 | describe('footer-link', () => { 5 | test('create', () => { 6 | const wrapper = shallowMount(FooterLink, { 7 | propsData: {}, 8 | }) 9 | 10 | expect(wrapper.name()).toBe('w-footer-link') 11 | expect(wrapper.classes()).toContain('weui-footer__link') 12 | 13 | expect(wrapper.html()).toMatchSnapshot() 14 | }) 15 | 16 | test('text', () => { 17 | const wrapper = shallowMount(FooterLink, { 18 | propsData: { 19 | text: 'test', 20 | }, 21 | }) 22 | 23 | expect(wrapper.text()).toBe('test') 24 | 25 | expect(wrapper.html()).toMatchSnapshot() 26 | }) 27 | 28 | test('handle click', () => { 29 | const routeLinkSpy = jest.fn() 30 | const wrapper = shallowMount(FooterLink, { 31 | propsData: {}, 32 | methods: { 33 | routeLink: routeLinkSpy, 34 | }, 35 | }) 36 | 37 | wrapper.trigger('click') 38 | expect(wrapper.emitted().click).toBeTruthy() 39 | expect(routeLinkSpy).toHaveBeenCalled() 40 | }) 41 | }) 42 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WFooter/__test__/__snapshots__/WFooter.spec.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`footer create 1`] = ` 4 | 7 | `; 8 | 9 | exports[`footer render with links 1`] = ` 10 | 17 | `; 18 | 19 | exports[`footer text 1`] = ` 20 | 23 | `; 24 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WFooter/__test__/__snapshots__/WFooterLink.spec.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`footer-link create 1`] = ``; 4 | 5 | exports[`footer-link text 1`] = ``; 6 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WFooter/index.ts: -------------------------------------------------------------------------------- 1 | import WFooter from './WFooter' 2 | 3 | export { WFooter } 4 | export default WFooter 5 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WFormPreview/index.ts: -------------------------------------------------------------------------------- 1 | import WFormPreview from './WFormPreview' 2 | 3 | export { WFormPreview } 4 | export default WFormPreview 5 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WGrid/WGrid.ts: -------------------------------------------------------------------------------- 1 | import Vue, { VNode } from 'vue' 2 | import '@/scss/grid.scss' 3 | 4 | export default Vue.extend({ 5 | name: 'w-grid', 6 | 7 | functional: true, 8 | 9 | render (h, context): VNode { 10 | return h('div', { 11 | ...context.data, 12 | class: 'weui-grids', 13 | }, context.children) 14 | }, 15 | }) 16 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WGrid/__test__/WGrid.spec.ts: -------------------------------------------------------------------------------- 1 | import { shallowMount } from '@vue/test-utils' 2 | import Grid from '../' 3 | 4 | describe('grid', () => { 5 | test('create', () => { 6 | const wrapper = shallowMount(Grid, { 7 | propsData: {}, 8 | }) 9 | 10 | expect(wrapper.classes()).toContain('weui-grids') 11 | 12 | expect(wrapper.html()).toMatchSnapshot() 13 | }) 14 | }) 15 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WGrid/__test__/__snapshots__/WGrid.spec.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`grid create 1`] = `
`; 4 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WGrid/index.ts: -------------------------------------------------------------------------------- 1 | import WGrid from './WGrid' 2 | 3 | export { WGrid } 4 | export default WGrid 5 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WGridItem/WGridItem.tsx: -------------------------------------------------------------------------------- 1 | import Routeable from '@/mixins/routable' 2 | 3 | import mixins from '@/utils/mixins' 4 | 5 | export default mixins( 6 | Routeable 7 | /* @vue/component */ 8 | ).extend({ 9 | name: 'w-grid-item', 10 | 11 | methods: { 12 | onClick () { 13 | this.$emit('click') 14 | this.routeLink() 15 | }, 16 | }, 17 | 18 | render () { 19 | return ( 20 |
{ 21 | this.onClick() 22 | }}> 23 | { 24 | this.$slots.icon && 25 |
26 | {this.$slots.icon} 27 |
28 | } 29 | { 30 | this.$slots.label && 31 |

32 | {this.$slots.label} 33 |

34 | } 35 | { this.$slots.default } 36 |
37 | ) 38 | }, 39 | }) 40 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WGridItem/__test__/WGridItem.spec.ts: -------------------------------------------------------------------------------- 1 | import { shallowMount } from '@vue/test-utils' 2 | import GridItem from '../' 3 | 4 | describe('grid-item', () => { 5 | test('create', () => { 6 | const wrapper = shallowMount(GridItem, { 7 | propsData: {}, 8 | }) 9 | 10 | expect(wrapper.name()).toBe('w-grid-item') 11 | expect(wrapper.classes()).toContain('weui-grid') 12 | 13 | expect(wrapper.html()).toMatchSnapshot() 14 | }) 15 | 16 | test('handle click', () => { 17 | const routeLinkSpy = jest.fn() 18 | const wrapper = shallowMount(GridItem, { 19 | propsData: {}, 20 | methods: { 21 | routeLink: routeLinkSpy, 22 | }, 23 | }) 24 | 25 | wrapper.trigger('click') 26 | expect(wrapper.emitted().click).toBeTruthy() 27 | expect(routeLinkSpy).toHaveBeenCalled() 28 | }) 29 | }) 30 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WGridItem/__test__/__snapshots__/WGridItem.spec.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`grid-item create 1`] = `
`; 4 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WGridItem/index.ts: -------------------------------------------------------------------------------- 1 | import WGridItem from './WGridItem' 2 | 3 | export { WGridItem } 4 | export default WGridItem 5 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WGroup/WGroup.tsx: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import '@/scss/group.scss' 3 | 4 | export default Vue.extend({ 5 | name: 'w-group', 6 | 7 | functional: true, 8 | 9 | props: { 10 | title: String, 11 | titleColor: String, 12 | }, 13 | 14 | render (h, context) { 15 | return ( 16 |
17 | { 18 | context.props.title && 19 |
24 | } 25 |
26 | {context.children} 27 |
28 |
29 | ) 30 | }, 31 | }) 32 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WGroup/__test__/WGroup.spec.ts: -------------------------------------------------------------------------------- 1 | import { shallowMount } from '@vue/test-utils' 2 | import Group from '../' 3 | 4 | describe('group', () => { 5 | test('create', () => { 6 | const wrapper = shallowMount(Group, { 7 | propsData: {}, 8 | }) 9 | 10 | expect(wrapper.contains('.weui-cells')).toBeTruthy() 11 | expect(wrapper.html()).toMatchSnapshot() 12 | }) 13 | 14 | test('create with title', () => { 15 | const wrapper = shallowMount(Group, { 16 | propsData: { 17 | title: 'test', 18 | }, 19 | }) 20 | 21 | expect(wrapper.contains('.weui-cells__title')).toBeTruthy() 22 | expect(wrapper.find('.weui-cells__title').text()).toBe('test') 23 | 24 | expect(wrapper.html()).toMatchSnapshot() 25 | }) 26 | }) 27 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WGroup/__test__/__snapshots__/WGroup.spec.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`group create 1`] = ` 4 |
5 |
6 |
7 | `; 8 | 9 | exports[`group create with title 1`] = ` 10 |
11 |
test
12 |
13 |
14 | `; 15 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WGroup/index.ts: -------------------------------------------------------------------------------- 1 | import WGroup from './WGroup' 2 | 3 | export { WGroup } 4 | export default WGroup 5 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WHeader/WHeader.tsx: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import '@/scss/header.scss' 3 | 4 | export default Vue.extend({ 5 | name: 'w-header', 6 | 7 | props: { 8 | title: String, 9 | fixed: { 10 | type: Boolean, 11 | default: true, 12 | }, 13 | backgroundColor: { 14 | type: String, 15 | default: '#21292c', 16 | }, 17 | }, 18 | 19 | methods: { 20 | onClick (e: Event) { 21 | e.stopPropagation() 22 | this.$emit('headerClick') 23 | }, 24 | }, 25 | 26 | render () { 27 | return ( 28 |
36 |
37 | {this.$slots.left} 38 |
39 |
40 |
41 | {this.$slots.right} 42 |
43 |
44 | ) 45 | }, 46 | }) 47 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WHeader/__test__/WHeader.spec.ts: -------------------------------------------------------------------------------- 1 | import { shallowMount } from '@vue/test-utils' 2 | import Header from '../' 3 | 4 | describe('header', () => { 5 | test('create', () => { 6 | const wrapper = shallowMount(Header, { 7 | propsData: {}, 8 | }) 9 | 10 | expect(wrapper.name()).toBe('w-header') 11 | expect(wrapper.classes()).toContain('wv-header') 12 | 13 | expect(wrapper.html()).toMatchSnapshot() 14 | 15 | expect(wrapper.html()).toMatchSnapshot() 16 | }) 17 | 18 | test('click header', () => { 19 | const wrapper = shallowMount(Header, { 20 | propsData: {}, 21 | }) 22 | 23 | wrapper.trigger('click') 24 | 25 | expect(wrapper.emitted('headerClick')).toBeTruthy() 26 | }) 27 | }) 28 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WHeader/__test__/__snapshots__/WHeader.spec.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`header create 1`] = ` 4 |
5 |
6 |
7 |
8 |
9 | `; 10 | 11 | exports[`header create 2`] = ` 12 |
13 |
14 |
15 |
16 |
17 | `; 18 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WHeader/index.ts: -------------------------------------------------------------------------------- 1 | import WHeader from './WHeader' 2 | 3 | export { WHeader } 4 | export default WHeader 5 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WIcon/WIcon.ts: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import '@/scss/icon.scss' 3 | // Types 4 | import { VNode } from 'vue/types/vnode' 5 | 6 | export default Vue.extend({ 7 | name: 'w-icon', 8 | 9 | props: { 10 | type: { 11 | type: String, 12 | required: true, 13 | }, 14 | large: Boolean, 15 | }, 16 | 17 | computed: { 18 | classes (): object { 19 | const classType = `weui-icon-${this.type}` 20 | 21 | return { 22 | [classType]: true, 23 | 'weui-icon_msg': this.large, 24 | } 25 | }, 26 | }, 27 | 28 | render (h): VNode { 29 | return h('span', { 30 | class: this.classes, 31 | }) 32 | }, 33 | }) 34 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WIcon/__test__/WIcon.spec.ts: -------------------------------------------------------------------------------- 1 | import { shallowMount } from '@vue/test-utils' 2 | import Icon from '../' 3 | 4 | describe('icon', () => { 5 | test('create', () => { 6 | const wrapper = shallowMount(Icon, { 7 | propsData: { 8 | type: 'info', 9 | }, 10 | }) 11 | 12 | expect(wrapper.name()).toBe('w-icon') 13 | 14 | expect(wrapper.html()).toMatchSnapshot() 15 | 16 | // is not 'large' by default 17 | expect(wrapper.vm.large).toBeFalsy() 18 | }) 19 | 20 | test('element class should be computed correctly', () => { 21 | const wrapper = shallowMount(Icon, { 22 | propsData: { 23 | type: 'info', 24 | large: true, 25 | }, 26 | }) 27 | 28 | // large size icon should has class 'weui-icon_msg' 29 | expect(wrapper.classes()).toContain('weui-icon_msg') 30 | 31 | const iconClassType = `weui-icon-${wrapper.vm.type}` 32 | expect(wrapper.classes()).toContain(iconClassType) 33 | }) 34 | }) 35 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WIcon/__test__/__snapshots__/WIcon.spec.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`icon create 1`] = ``; 4 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WIcon/index.ts: -------------------------------------------------------------------------------- 1 | import WIcon from './WIcon' 2 | 3 | export { WIcon } 4 | export default WIcon 5 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WInput/__test__/__snapshots__/WInput.spec.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`input create 1`] = ` 4 |
5 |
6 |
7 |
8 |
9 | `; 10 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WInput/index.ts: -------------------------------------------------------------------------------- 1 | import WInput from './WInput' 2 | 3 | export { WInput } 4 | export default WInput 5 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WLoadmore/WLoadmore.tsx: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import '@/scss/loadmore.scss' 3 | 4 | import WVSpinner from '../WSpinner' 5 | 6 | export default Vue.extend({ 7 | name: 'w-loadmore', 8 | 9 | props: { 10 | type: { 11 | type: String, 12 | default: 'default', 13 | }, 14 | text: { 15 | type: String, 16 | default: '正在加载', 17 | }, 18 | }, 19 | 20 | render () { 21 | return ( 22 |
29 | { this.type === 'default' && } 30 | 31 |
32 | ) 33 | }, 34 | }) 35 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WLoadmore/__test__/WLoadmore.spec.ts: -------------------------------------------------------------------------------- 1 | import { shallowMount } from '@vue/test-utils' 2 | import Loadmore from '../' 3 | 4 | describe('loadmore', () => { 5 | test('create', () => { 6 | const wrapper = shallowMount(Loadmore, { 7 | propsData: {}, 8 | }) 9 | 10 | expect(wrapper.name()).toBe('w-loadmore') 11 | expect(wrapper.classes()).toContain('weui-loadmore') 12 | expect(wrapper.html()).toMatchSnapshot() 13 | }) 14 | 15 | test('text', () => { 16 | const wrapper = shallowMount(Loadmore, { 17 | propsData: { 18 | text: 'test', 19 | }, 20 | }) 21 | 22 | expect(wrapper.find('.weui-loadmore__tips').text()).toBe('test') 23 | expect(wrapper.html()).toMatchSnapshot() 24 | }) 25 | }) 26 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WLoadmore/__test__/__snapshots__/WLoadmore.spec.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`loadmore create 1`] = ` 4 |
5 | 正在加载 6 |
7 | `; 8 | 9 | exports[`loadmore text 1`] = ` 10 |
11 | test 12 |
13 | `; 14 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WLoadmore/index.ts: -------------------------------------------------------------------------------- 1 | import WLoadmore from './WLoadmore' 2 | 3 | export { WLoadmore } 4 | export default WLoadmore 5 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WMediaBox/__test__/WMediaBox.spec.ts: -------------------------------------------------------------------------------- 1 | import { shallowMount } from '@vue/test-utils' 2 | import MediaBox from '../' 3 | 4 | describe('media-box', () => { 5 | test('create', () => { 6 | let wrapper = shallowMount(MediaBox, { 7 | propsData: {}, 8 | }) 9 | 10 | expect(wrapper.name()).toBe('w-media-box') 11 | expect(wrapper.html()).toMatchSnapshot() 12 | 13 | wrapper = shallowMount(MediaBox, { 14 | propsData: { 15 | type: 'text', 16 | }, 17 | }) 18 | 19 | expect(wrapper.name()).toBe('w-media-box') 20 | expect(wrapper.html()).toMatchSnapshot() 21 | }) 22 | 23 | test('handle click', () => { 24 | const routeLinkSpy = jest.fn() 25 | const wrapper = shallowMount(MediaBox, { 26 | propsData: {}, 27 | methods: { 28 | routeLink: routeLinkSpy, 29 | }, 30 | }) 31 | 32 | wrapper.trigger('click') 33 | expect(wrapper.emitted().click).toBeTruthy() 34 | expect(routeLinkSpy).toHaveBeenCalled() 35 | }) 36 | }) 37 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WMediaBox/__test__/__snapshots__/WMediaBox.spec.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`media-box create 1`] = ` 4 |
5 |
6 |
7 |

8 |

9 |
10 |
11 | `; 12 | 13 | exports[`media-box create 2`] = ` 14 |
15 |

16 |

17 |
18 | `; 19 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WMediaBox/index.ts: -------------------------------------------------------------------------------- 1 | import WMediaBox from './WMediaBox' 2 | 3 | export { WMediaBox } 4 | export default WMediaBox 5 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WNumberSpinner/__test__/__snapshots__/WNumberSpinner.spec.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`number-spinner create 1`] = `
`; 4 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WNumberSpinner/index.ts: -------------------------------------------------------------------------------- 1 | import WNumberSpinner from './WNumberSpinner' 2 | 3 | export { WNumberSpinner } 4 | export default WNumberSpinner 5 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WPanel/WPanel.tsx: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import '@/scss/panel.scss' 3 | 4 | export default Vue.extend({ 5 | name: 'w-panel', 6 | 7 | props: { 8 | title: String, 9 | }, 10 | 11 | render () { 12 | return ( 13 |
14 | { 15 | this.title && 16 |
20 | } 21 |
22 | {this.$slots.default} 23 |
24 |
25 | {this.$slots.ft} 26 |
27 |
28 | ) 29 | }, 30 | }) 31 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WPanel/__test__/WPanel.spec.ts: -------------------------------------------------------------------------------- 1 | import { shallowMount } from '@vue/test-utils' 2 | import Panel from '../' 3 | 4 | describe('panel', () => { 5 | test('create', () => { 6 | const wrapper = shallowMount(Panel, { 7 | propsData: {}, 8 | }) 9 | 10 | expect(wrapper.name()).toBe('w-panel') 11 | expect(wrapper.classes()).toContain('weui-panel') 12 | 13 | expect(wrapper.html()).toMatchSnapshot() 14 | }) 15 | 16 | test('render with title', () => { 17 | const wrapper = shallowMount(Panel, { 18 | propsData: { 19 | title: 'test-title', 20 | }, 21 | }) 22 | 23 | expect(wrapper.contains('.weui-panel__hd')).toBeTruthy() 24 | expect(wrapper.find('.weui-panel__hd').text()).toBe('test-title') 25 | 26 | expect(wrapper.html()).toMatchSnapshot() 27 | }) 28 | }) 29 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WPanel/__test__/__snapshots__/WPanel.spec.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`panel create 1`] = ` 4 |
5 |
6 |
7 |
8 | `; 9 | 10 | exports[`panel render with title 1`] = ` 11 |
12 |
test-title
13 |
14 |
15 |
16 | `; 17 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WPanel/index.ts: -------------------------------------------------------------------------------- 1 | import WPanel from './WPanel' 2 | 3 | export { WPanel } 4 | export default WPanel 5 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WPicker/index.ts: -------------------------------------------------------------------------------- 1 | import WPicker from './WPicker' 2 | 3 | export { WPicker } 4 | export default WPicker 5 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WPopup/__test__/__snapshots__/WPopup.spec.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`popup create 1`] = ``; 4 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WPopup/index.ts: -------------------------------------------------------------------------------- 1 | import WPopup from './WPopup' 2 | 3 | export { WPopup } 4 | export default WPopup 5 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WProgress/__test__/__snapshots__/WProgress.spec.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`progress create 1`] = ` 4 |
5 |
6 |
7 |
8 |
9 | `; 10 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WProgress/index.ts: -------------------------------------------------------------------------------- 1 | import WProgress from './WProgress' 2 | 3 | export { WProgress } 4 | export default WProgress 5 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WRadio/index.ts: -------------------------------------------------------------------------------- 1 | import WRadio from './WRadio' 2 | 3 | export { WRadio } 4 | export default WRadio 5 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WSearchBar/__test__/__snapshots__/WSearchBar.spec.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`search create 1`] = ` 4 |
5 | 13 | 14 |
15 | `; 16 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WSearchBar/index.ts: -------------------------------------------------------------------------------- 1 | import WSearchBar from './WSearchBar' 2 | 3 | export { WSearchBar } 4 | export default WSearchBar 5 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WSlider/__test__/__snapshots__/WSlider.spec.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`slider create 1`] = ` 4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | `; 14 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WSlider/index.ts: -------------------------------------------------------------------------------- 1 | import WSlider from './WSlider' 2 | 3 | export { WSlider } 4 | export default WSlider 5 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WSpinner/__test__/__snapshots__/WSpinner.spec.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`spinner color 1`] = ``; 4 | 5 | exports[`spinner create 1`] = ``; 6 | 7 | exports[`spinner size 1`] = ``; 8 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WSpinner/index.ts: -------------------------------------------------------------------------------- 1 | import WSpinner from './WSpinner' 2 | 3 | export { WSpinner } 4 | export default WSpinner 5 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WSwipe/__test__/__snapshots__/WSwipe.spec.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`swipe create 1`] = ` 4 |
5 |
6 |
7 | `; 8 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WSwipe/index.ts: -------------------------------------------------------------------------------- 1 | import WSwipe from './WSwipe' 2 | 3 | export { WSwipe } 4 | export default WSwipe 5 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WSwipeCell/__test__/__snapshots__/WSwipeCell.spec.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`cell-swipe create 1`] = ` 4 |
5 |
6 | 7 |
8 |
9 |
test
10 |
test
11 |
12 |
13 | `; 14 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WSwipeCell/index.ts: -------------------------------------------------------------------------------- 1 | import WSwipeCell from './WSwipeCell' 2 | 3 | export { WSwipeCell } 4 | export default WSwipeCell 5 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WSwipeCellButton/WSwipeCellButton.ts: -------------------------------------------------------------------------------- 1 | import '@/scss/cell-swipe-button.scss' 2 | 3 | import Vue from 'vue' 4 | import { VNode } from 'vue/types/vnode' 5 | 6 | export default Vue.extend({ 7 | name: 'w-cell-swipe-button', 8 | 9 | props: { 10 | type: { 11 | type: String, 12 | default: 'default', 13 | }, 14 | }, 15 | 16 | render (h): VNode { 17 | const classes = [ 18 | 'weui-swiped-btn', 19 | 'weui-swiped-btn_' + this.type, 20 | ] 21 | 22 | return h('div', { 23 | class: classes, 24 | }, [ 25 | this.$slots.default, 26 | ]) 27 | }, 28 | }) 29 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WSwipeCellButton/__test__/WSwipeCellButton.spec.ts: -------------------------------------------------------------------------------- 1 | import { shallowMount } from '@vue/test-utils' 2 | import SwipeCellButton from '../' 3 | 4 | describe('cell-swipe-button', () => { 5 | test('create', () => { 6 | let wrapper = shallowMount(SwipeCellButton, { 7 | propsData: {}, 8 | }) 9 | 10 | expect(wrapper.name()).toBe('w-cell-swipe-button') 11 | expect(wrapper.classes()).toContain('weui-swiped-btn') 12 | 13 | expect(wrapper.html()).toMatchSnapshot() 14 | 15 | // create with type 16 | wrapper = shallowMount(SwipeCellButton, { 17 | propsData: { 18 | type: 'test', 19 | }, 20 | }) 21 | 22 | expect(wrapper.classes()).toContain('weui-swiped-btn_test') 23 | 24 | wrapper = shallowMount(SwipeCellButton, { 25 | slots: { 26 | default: 'test', 27 | }, 28 | }) 29 | 30 | expect(wrapper.text()).toBe('test') 31 | }) 32 | }) 33 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WSwipeCellButton/__test__/__snapshots__/WSwipeCellButton.spec.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`cell-swipe-button create 1`] = `
`; 4 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WSwipeCellButton/index.ts: -------------------------------------------------------------------------------- 1 | import WSwipeCellButton from './WSwipeCellButton' 2 | 3 | export { WSwipeCellButton } 4 | export default WSwipeCellButton 5 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WSwipeItem/WSwipeItem.tsx: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | 3 | interface options extends Vue { 4 | $parent: Vue & { 5 | vertical: number 6 | computedWidth: number 7 | computedHeight: number 8 | swipes: any[] 9 | } 10 | } 11 | 12 | export default Vue.extend().extend({ 13 | name: 'w-swipe-item', 14 | 15 | data () { 16 | return { 17 | offset: 0, 18 | } 19 | }, 20 | 21 | beforeCreate (): void { 22 | this.$parent.swipes.push(this) 23 | }, 24 | 25 | destroyed (): void { 26 | this.$parent.swipes.splice(this.$parent.swipes.indexOf(this), 1) 27 | }, 28 | 29 | render () { 30 | const { vertical, computedWidth, computedHeight } = this.$parent 31 | 32 | const style = { 33 | width: computedWidth + 'px', 34 | height: vertical ? computedHeight + 'px' : '100%', 35 | transform: vertical ? `translate3d(0, ${this.offset}px, 0)` : `translate3d(${this.offset}px, 0, 0)`, 36 | } 37 | 38 | return ( 39 |
40 | {this.$slots.default} 41 |
42 | ) 43 | }, 44 | }) 45 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WSwipeItem/index.ts: -------------------------------------------------------------------------------- 1 | import WSwipeItem from './WSwipeItem' 2 | 3 | export { WSwipeItem } 4 | export default WSwipeItem 5 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WSwitch/__test__/__snapshots__/WSwitch.spec.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`switch create 1`] = ` 4 |
5 |
6 |
7 |
8 | `; 9 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WSwitch/index.ts: -------------------------------------------------------------------------------- 1 | import WSwitch from './WSwitch' 2 | 3 | export { WSwitch } 4 | export default WSwitch 5 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WSwitchCell/WSwitchCell.tsx: -------------------------------------------------------------------------------- 1 | // Utils 2 | import mixins from '@/utils/mixins' 3 | 4 | import WCell from '../WCell' 5 | import WSwitch from '../WSwitch' 6 | 7 | // Mixins 8 | import Toggleable from '@/mixins/toggleable' 9 | 10 | export default mixins( 11 | Toggleable 12 | ).extend({ 13 | name: 'w-switch-cell', 14 | 15 | components: { 16 | WCell, 17 | WSwitch, 18 | }, 19 | 20 | props: { 21 | title: String, 22 | disabled: Boolean, 23 | }, 24 | 25 | render () { 26 | return ( 27 | 28 | 33 | 34 | ) 35 | }, 36 | }) 37 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WSwitchCell/__test__/__snapshots__/WSwitchCell.spec.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`switch-cell create 1`] = ` 4 |
5 |
6 |
7 |

8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | `; 17 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WSwitchCell/index.ts: -------------------------------------------------------------------------------- 1 | import WSwitchCell from './WSwitchCell' 2 | 3 | export { WSwitchCell } 4 | export default WSwitchCell 5 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WTab/__test__/WTab.spec.ts: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import { mount } from '@vue/test-utils' 3 | import WTabs from '../../WTabs' 4 | import WTab from '../' 5 | 6 | describe('tab', () => { 7 | test('create', () => { 8 | const wrapper = mount(WTabs, { 9 | attachToDocument: true, 10 | propsData: {}, 11 | slots: { 12 | default: [WTab, WTab, WTab], 13 | }, 14 | }) 15 | 16 | expect(wrapper.html()).toMatchSnapshot() 17 | }) 18 | 19 | test('destroy', () => { 20 | const wrapper = mount(WTabs, { 21 | attachToDocument: true, 22 | propsData: {}, 23 | slots: { 24 | default: [WTab, WTab, WTab], 25 | }, 26 | }) 27 | 28 | wrapper.findAll(WTab).at(0).vm.$destroy() 29 | 30 | expect(wrapper.vm.tabs).toHaveLength(2) 31 | }) 32 | 33 | test('render title slot', () => { 34 | Vue.component('w-tab', WTab) 35 | 36 | const wrapper = mount(WTabs, { 37 | attachToDocument: true, 38 | propsData: {}, 39 | slots: { 40 | default: ['titlecontent1'], 41 | }, 42 | }) 43 | 44 | expect(wrapper.html()).toMatchSnapshot() 45 | }) 46 | }) 47 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WTab/__test__/__snapshots__/WTab.spec.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`tab create 1`] = ` 4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | `; 17 | 18 | exports[`tab render title slot 1`] = ` 19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
content1
title
28 |
29 |
30 |
31 | `; 32 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WTab/index.ts: -------------------------------------------------------------------------------- 1 | import WTab from './WTab' 2 | 3 | export { WTab } 4 | export default WTab 5 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WTabbar/WTabbar.ts: -------------------------------------------------------------------------------- 1 | import '@/scss/tabbar.scss' 2 | 3 | import Vue, { VNode } from 'vue' 4 | 5 | export default Vue.extend({ 6 | name: 'w-tabbar', 7 | 8 | props: { 9 | fixed: Boolean, 10 | }, 11 | 12 | render (h): VNode { 13 | const style = { position: this.fixed ? 'fixed' : 'absolute' } 14 | 15 | return h('div', { 16 | class: 'weui-tabbar', 17 | style: style, 18 | }, this.$slots.default) 19 | }, 20 | }) 21 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WTabbar/__test__/WTabbar.spec.ts: -------------------------------------------------------------------------------- 1 | import { shallowMount } from '@vue/test-utils' 2 | import Tabbar from '../' 3 | 4 | describe('tabbar', () => { 5 | test('create', () => { 6 | const wrapper = shallowMount(Tabbar, { 7 | propsData: {}, 8 | }) 9 | 10 | expect(wrapper.name()).toBe('w-tabbar') 11 | expect(wrapper.classes()).toContain('weui-tabbar') 12 | 13 | expect(wrapper.html()).toMatchSnapshot() 14 | }) 15 | 16 | test('fixed tabbar', () => { 17 | // is not fixed by default 18 | let wrapper = shallowMount(Tabbar, { 19 | propsData: {}, 20 | }) 21 | 22 | expect(wrapper.element.style.position).toBe('absolute') 23 | 24 | wrapper = shallowMount(Tabbar, { 25 | propsData: { 26 | fixed: true, 27 | }, 28 | }) 29 | 30 | expect(wrapper.element.style.position).toBe('fixed') 31 | }) 32 | }) 33 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WTabbar/__test__/__snapshots__/WTabbar.spec.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`tabbar create 1`] = `
`; 4 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WTabbar/index.ts: -------------------------------------------------------------------------------- 1 | import WTabbar from './WTabbar' 2 | 3 | export { WTabbar } 4 | export default WTabbar 5 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WTabbarItem/WTabbarItem.tsx: -------------------------------------------------------------------------------- 1 | // Utils 2 | import mixins from '@/utils/mixins' 3 | 4 | // Mixins 5 | import Routeable from '@/mixins/routable' 6 | 7 | export default mixins( 8 | Routeable 9 | ).extend({ 10 | name: 'w-tabbar-item', 11 | 12 | mixins: [Routeable], 13 | 14 | props: { 15 | isOn: Boolean, 16 | }, 17 | 18 | methods: { 19 | onClick () { 20 | this.$emit('click') 21 | this.routeLink() 22 | }, 23 | }, 24 | 25 | render () { 26 | return ( 27 |
{ this.onClick() }} 33 | > 34 | {this.$slots.icon} 35 |

36 | {this.$slots.default} 37 |

38 |
39 | ) 40 | }, 41 | }) 42 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WTabbarItem/__test__/__snapshots__/WTabbarItem.spec.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`tabbar-item create 1`] = ` 4 |
5 |

6 |
7 | `; 8 | 9 | exports[`tabbar-item text 1`] = ` 10 |
11 |

test

12 |
13 | `; 14 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WTabbarItem/index.ts: -------------------------------------------------------------------------------- 1 | import WTabbarItem from './WTabbarItem' 2 | 3 | export { WTabbarItem } 4 | export default WTabbarItem 5 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WTabs/index.ts: -------------------------------------------------------------------------------- 1 | import WTabs from './WTabs' 2 | 3 | export { WTabs } 4 | export default WTabs 5 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WTextarea/__test__/__snapshots__/WTextarea.spec.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`textarea create 1`] = ` 4 |
5 |
6 |
0/100
7 |
8 |
9 | `; 10 | 11 | exports[`textarea show counter 1`] = ` 12 |
13 |
14 |
0/100
15 |
16 |
17 | `; 18 | 19 | exports[`textarea show counter 2`] = ` 20 |
21 |
22 |
23 | `; 24 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WTextarea/index.ts: -------------------------------------------------------------------------------- 1 | import WTextarea from './WTextarea' 2 | 3 | export { WTextarea } 4 | export default WTextarea 5 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WTopTips/WTopTips.tsx: -------------------------------------------------------------------------------- 1 | import '@/scss/top-tips.scss' 2 | import PopupMixin from '@/mixins/popup' 3 | 4 | import mixins from '@/utils/mixins' 5 | import { VNode } from 'vue' 6 | 7 | export default mixins( 8 | PopupMixin 9 | ).extend({ 10 | name: 'w-top-tips', 11 | 12 | props: { 13 | message: { 14 | type: String, 15 | default: '', 16 | required: false, 17 | }, 18 | }, 19 | 20 | render (): VNode { 21 | return ( 22 | 26 |
31 | 32 | ) 33 | }, 34 | }) 35 | -------------------------------------------------------------------------------- /packages/we-vue/src/components/WTopTips/__test__/__snapshots__/WTopTips.spec.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`top-tips component create 1`] = `
`; 4 | 5 | exports[`top-tips component should render message correctlly 1`] = ` 6 | 7 |
test
8 |
9 | `; 10 | -------------------------------------------------------------------------------- /packages/we-vue/src/directives/click-outside.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * v-click-outside 3 | * 4 | * ```vue 5 | *
6 | * ``` 7 | */ 8 | 9 | import { VNodeDirective } from 'vue/types/vnode' 10 | 11 | interface ClickOutsideDirective extends VNodeDirective{ 12 | value?: (e: Event) => void 13 | } 14 | 15 | export default { 16 | inserted (el: HTMLElement, binding: ClickOutsideDirective) { 17 | el._clickOutside = (e: Event) => { 18 | if (!el.contains(e.target as HTMLElement)) { 19 | binding.value!(e) 20 | } 21 | } 22 | document.body.addEventListener('click', el._clickOutside, true) 23 | }, 24 | 25 | unbind (el: HTMLElement) { 26 | /* istanbul ignore next */ 27 | if (!el._clickOutside) { 28 | return 29 | } 30 | 31 | document.body.removeEventListener('click', el._clickOutside, true) 32 | delete el._clickOutside 33 | }, 34 | } 35 | -------------------------------------------------------------------------------- /packages/we-vue/src/directives/index.ts: -------------------------------------------------------------------------------- 1 | import ClickOutside from './click-outside' 2 | import InfiniteScroll from './infinite-scroll' 3 | 4 | export { 5 | ClickOutside, 6 | InfiniteScroll, 7 | } 8 | 9 | export default { 10 | ClickOutside, 11 | InfiniteScroll, 12 | } 13 | -------------------------------------------------------------------------------- /packages/we-vue/src/entry-lib.ts: -------------------------------------------------------------------------------- 1 | export * from './components' 2 | export * from './directives' 3 | -------------------------------------------------------------------------------- /packages/we-vue/src/index.ts: -------------------------------------------------------------------------------- 1 | // Styles 2 | import './scss/index.scss' 3 | 4 | import * as components from './components' 5 | import * as directives from './directives' 6 | import * as plugins from './plugins' 7 | 8 | import { install } from './install' 9 | 10 | export default class WeVue { 11 | static version = __WE_VUE_VERSION__ 12 | 13 | // @ts-ignore 14 | static install = (Vue, args) => { 15 | install.call(WeVue, Vue, { 16 | components, 17 | directives, 18 | plugins, 19 | ...args, 20 | }) 21 | } 22 | } 23 | 24 | if (typeof window !== 'undefined' && window.Vue) { 25 | window.Vue.use(WeVue) 26 | } 27 | -------------------------------------------------------------------------------- /packages/we-vue/src/install.ts: -------------------------------------------------------------------------------- 1 | import { VueConstructor } from 'vue' 2 | import { WeVueUseOptions } from 'types' 3 | 4 | export function install (Vue: VueConstructor, args: WeVueUseOptions = {}) { 5 | if ((install as any).installed) return 6 | (install as any).installed = true 7 | 8 | const components = args.components || {} 9 | const directives = args.directives || {} 10 | const plugins = args.plugins || {} 11 | 12 | for (const name in directives) { 13 | const directive = directives[name] 14 | Vue.directive(name, directive) 15 | } 16 | 17 | for (const name in plugins) { 18 | const plugin = plugins[name] 19 | Vue.use(plugin) 20 | } 21 | 22 | ;(function registerComponents (components: any) { 23 | if (components) { 24 | for (const key in components) { 25 | const component = components[key] 26 | Vue.component(key, component as typeof Vue) 27 | } 28 | return true 29 | } 30 | return false 31 | })(components) 32 | } 33 | -------------------------------------------------------------------------------- /packages/we-vue/src/mixins/find-parent/__test__/find-parent.spec.ts: -------------------------------------------------------------------------------- 1 | import { mount, Wrapper } from '@vue/test-utils' 2 | import FindParentMixin from '@/mixins/find-parent' 3 | 4 | describe('mixins/find-parent', () => { 5 | type MockWrapper = Wrapper> 6 | 7 | test('mixed props', () => { 8 | const wrapper = mount({ 9 | mixins: [FindParentMixin], 10 | render (h) { 11 | return h('div', {}) 12 | }, 13 | }, { 14 | propsData: {}, 15 | }) as MockWrapper 16 | 17 | expect(wrapper.vm.findParent('test')).toBeFalsy() 18 | }) 19 | }) 20 | -------------------------------------------------------------------------------- /packages/we-vue/src/mixins/find-parent/index.ts: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | 3 | export default Vue.extend({ 4 | data () { 5 | return { 6 | parent: {} as Vue, 7 | } 8 | }, 9 | 10 | methods: { 11 | findParent (name: string): void { 12 | let parent = this.$parent 13 | while (parent) { 14 | if (parent.$options.name === name) { 15 | this.parent = parent 16 | break 17 | } 18 | parent = parent.$parent 19 | } 20 | }, 21 | }, 22 | }) 23 | -------------------------------------------------------------------------------- /packages/we-vue/src/mixins/picker/index.ts: -------------------------------------------------------------------------------- 1 | // Mixins 2 | import Toggleable, { factory as ToggleableFactory } from '../toggleable' 3 | 4 | // Utils 5 | import mixins, { ExtractVue } from '@/utils/mixins' 6 | 7 | export default mixins< 8 | ExtractVue<[typeof Toggleable]> 9 | >( 10 | ToggleableFactory('visible', 'update:visible') 11 | ).extend({ 12 | name: 'picker', 13 | 14 | props: { 15 | confirmText: { 16 | type: String, 17 | default: '确定', 18 | }, 19 | cancelText: { 20 | type: String, 21 | default: '取消', 22 | }, 23 | closeOnClickMask: { 24 | type: Boolean, 25 | default: true, 26 | }, 27 | }, 28 | 29 | methods: { 30 | open (): void { 31 | this.isActive = true 32 | }, 33 | 34 | close (): void { 35 | this.isActive = false 36 | }, 37 | }, 38 | }) 39 | -------------------------------------------------------------------------------- /packages/we-vue/src/mixins/popup/Modal.tsx: -------------------------------------------------------------------------------- 1 | import Vue, { VNode } from 'vue' 2 | import { PropValidator } from 'vue/types/options' 3 | 4 | interface options extends Vue { 5 | style?: object 6 | } 7 | 8 | export default Vue.extend().extend({ 9 | name: 'w-modal', 10 | 11 | props: { 12 | visible: Boolean, 13 | zIndex: Number, 14 | className: String, 15 | customStyle: Object as PropValidator, 16 | }, 17 | 18 | computed: { 19 | style (): object { 20 | return { 21 | zIndex: this.zIndex, 22 | ...this.customStyle, 23 | } 24 | }, 25 | }, 26 | 27 | render (h): VNode { 28 | return ( 29 | 30 |
{ 38 | this.$emit('click', event) 39 | }} 40 | /> 41 | 42 | ) 43 | }, 44 | }) 45 | -------------------------------------------------------------------------------- /packages/we-vue/src/mixins/popup/context.ts: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | 3 | export interface PopupableVue extends Vue { 4 | closeOnClickMask: boolean 5 | close (): void 6 | } 7 | 8 | type stackItem = { 9 | vm: PopupableVue 10 | config: { 11 | className: string 12 | customStyle: object 13 | } 14 | target: Element | Node 15 | } 16 | 17 | interface ModalInstance extends Vue { 18 | visible: boolean 19 | style?: object 20 | } 21 | 22 | const PopupContext = { 23 | zIndex: 2000, 24 | stack: [] as stackItem[], 25 | lockCount: 0, 26 | modal: {} as ModalInstance, 27 | 28 | get top (): stackItem { 29 | return this.stack[this.stack.length - 1] 30 | }, 31 | } 32 | 33 | export default PopupContext 34 | -------------------------------------------------------------------------------- /packages/we-vue/src/mixins/routable/index.ts: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | 3 | export default Vue.extend({ 4 | name: 'routable', 5 | 6 | props: { 7 | href: String, 8 | replace: Boolean, 9 | to: [String, Object], 10 | }, 11 | 12 | methods: { 13 | routeLink () { 14 | const { to, href, $router, replace } = this as any 15 | if (to && $router) { 16 | $router[replace ? 'replace' : 'push'](to) 17 | } else if (href) { 18 | replace ? location.replace(href) : location.href = href 19 | } 20 | }, 21 | }, 22 | }) 23 | -------------------------------------------------------------------------------- /packages/we-vue/src/mixins/toggleable/__test__/toggleable.spec.ts: -------------------------------------------------------------------------------- 1 | import { mount, Wrapper } from '@vue/test-utils' 2 | import Tggleable from '@/mixins/toggleable' 3 | 4 | describe('toggleable mixin', () => { 5 | type ToggleableInstance = InstanceType 6 | 7 | test('default toggle mixin', () => { 8 | const wrapper = mount({ 9 | mixins: [Tggleable], 10 | render: h => h('div'), 11 | }) as Wrapper 12 | 13 | expect(wrapper.props().value).toBeUndefined() 14 | }) 15 | }) 16 | -------------------------------------------------------------------------------- /packages/we-vue/src/mixins/toggleable/index.ts: -------------------------------------------------------------------------------- 1 | import Vue, { VueConstructor } from 'vue' 2 | 3 | /* eslint-disable-next-line no-use-before-define */ 4 | export type Toggleable = VueConstructor> 5 | 6 | export function factory (prop?: T, event?: string): Toggleable 7 | export function factory (prop = 'value', event = 'input') { 8 | return Vue.extend({ 9 | name: 'toggleable', 10 | 11 | props: { 12 | [prop]: { required: false }, 13 | }, 14 | 15 | data () { 16 | return { 17 | isActive: !!this[prop], 18 | } 19 | }, 20 | 21 | watch: { 22 | [prop] (val) { 23 | this.isActive = !!val 24 | }, 25 | isActive (val) { 26 | !!val !== this[prop] && this.$emit(event, val) 27 | }, 28 | }, 29 | }) 30 | } 31 | 32 | /* eslint-disable-next-line no-redeclare */ 33 | const Toggleable = factory() 34 | 35 | export default Toggleable 36 | -------------------------------------------------------------------------------- /packages/we-vue/src/mixins/touchable/__test__/touchable.spec.ts: -------------------------------------------------------------------------------- 1 | import { mount, Wrapper } from '@vue/test-utils' 2 | import Touchable from '@/mixins/touchable' 3 | 4 | describe('touchable mixin', () => { 5 | type InstanceTouchable = InstanceType 6 | 7 | test('default toggle mixin', () => { 8 | const wrapper = mount({ 9 | mixins: [Touchable], 10 | render: h => h('div'), 11 | }) as Wrapper 12 | 13 | expect(wrapper.vm.direction).toBe('') 14 | }) 15 | }) 16 | -------------------------------------------------------------------------------- /packages/we-vue/src/mixins/validatable/index.ts: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | 3 | export default Vue.extend({ 4 | name: 'validatable', 5 | 6 | props: { 7 | value: { 8 | required: false, 9 | }, 10 | }, 11 | 12 | data () { 13 | return { 14 | lazyValue: this.value, 15 | valid: false, 16 | } 17 | }, 18 | }) 19 | -------------------------------------------------------------------------------- /packages/we-vue/src/plugins/index.ts: -------------------------------------------------------------------------------- 1 | import Lazyload from './lazyload' 2 | 3 | export { 4 | Lazyload, 5 | } 6 | -------------------------------------------------------------------------------- /packages/we-vue/src/plugins/lazyload/__test__/lazyload.spec.ts: -------------------------------------------------------------------------------- 1 | import { Lazyload } from '@/plugins' 2 | 3 | describe('lazyload', () => { 4 | test('lazyload type', () => { 5 | expect(typeof Lazyload).toBe('object') 6 | }) 7 | }) 8 | -------------------------------------------------------------------------------- /packages/we-vue/src/plugins/lazyload/index.ts: -------------------------------------------------------------------------------- 1 | import Lazyload from 'vue-lazyload' 2 | 3 | export default Lazyload 4 | -------------------------------------------------------------------------------- /packages/we-vue/src/scss/badge.scss: -------------------------------------------------------------------------------- 1 | .weui-badge { 2 | display: inline-block; 3 | min-width: 8px; 4 | padding: 0.15em 0.4em; 5 | color: #fff; 6 | font-size: 12px; 7 | line-height: 1.2; 8 | text-align: center; 9 | vertical-align: middle; 10 | background-color: #f43530; 11 | border-radius: 18px; 12 | 13 | &_dot { 14 | min-width: 0; 15 | padding: 0.4em; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/we-vue/src/scss/base/fn.scss: -------------------------------------------------------------------------------- 1 | // mixin 2 | @import "./mixin/mobile"; 3 | @import "./mixin/setOnepx"; 4 | @import "./mixin/setArrow"; 5 | @import "./mixin/text"; 6 | // variable 7 | @import "./variable/global"; 8 | @import "./variable/color"; 9 | @import "./variable/weui-cell"; 10 | @import "./variable/weui-button"; 11 | @import "./variable/weui-msg"; 12 | @import "./variable/weui-grid"; 13 | @import "./variable/weui-progress"; 14 | @import "./variable/weui-dialog"; 15 | -------------------------------------------------------------------------------- /packages/we-vue/src/scss/base/mixin/mobile.scss: -------------------------------------------------------------------------------- 1 | @mixin setTapColor($c: rgba(0, 0, 0, 0)) { 2 | -webkit-tap-highlight-color: $c; 3 | } 4 | -------------------------------------------------------------------------------- /packages/we-vue/src/scss/base/mixin/setArrow.scss: -------------------------------------------------------------------------------- 1 | @mixin setArrow($direction, $arrowsize, $borderColor, $borderWidth) { 2 | display: inline-block; 3 | width: $arrowsize; 4 | height: $arrowsize; 5 | border-color: $borderColor; 6 | border-style: solid; 7 | border-width: $borderWidth $borderWidth 0 0; 8 | 9 | @if $direction == up { 10 | transform: matrix(0.71, -0.71, 0.71, 0.71, 0, 0); // rotate(-45deg) 11 | } 12 | 13 | @else if $direction == right { 14 | position: relative; 15 | top: -2px; 16 | transform: matrix(0.71, 0.71, -0.71, 0.71, 0, 0); // rotate(45deg); 17 | } 18 | 19 | @else if $direction == down { 20 | position: relative; 21 | top: -3px; 22 | transform: matrix(-0.71, 0.71, -0.71, -0.71, 0, 0); // rotate(135deg); 23 | } 24 | 25 | @else if $direction == left { 26 | position: relative; 27 | top: -2px; 28 | transform: matrix(-0.71, -0.71, 0.71, -0.71, 0, 0); // rotate(-135deg); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /packages/we-vue/src/scss/base/mixin/setOnepx.scss: -------------------------------------------------------------------------------- 1 | @mixin setTopLine($c: #c7c7c7) { 2 | position: absolute; 3 | top: 0; 4 | right: 0; 5 | left: 0; 6 | height: 1px; 7 | color: $c; 8 | border-top: 1px solid $c; 9 | transform: scaleY(0.5); 10 | transform-origin: 0 0; 11 | content: ""; 12 | } 13 | 14 | @mixin setBottomLine($c: #c7c7c7) { 15 | position: absolute; 16 | right: 0; 17 | bottom: 0; 18 | left: 0; 19 | height: 1px; 20 | color: $c; 21 | border-bottom: 1px solid $c; 22 | transform: scaleY(0.5); 23 | transform-origin: 0 100%; 24 | content: ""; 25 | } 26 | 27 | @mixin setLeftLine($c: #c7c7c7) { 28 | position: absolute; 29 | top: 0; 30 | bottom: 0; 31 | left: 0; 32 | width: 1px; 33 | color: $c; 34 | border-left: 1px solid $c; 35 | transform: scaleX(0.5); 36 | transform-origin: 0 0; 37 | content: ""; 38 | } 39 | 40 | @mixin setRightLine($c: #c7c7c7) { 41 | position: absolute; 42 | top: 0; 43 | right: 0; 44 | bottom: 0; 45 | width: 1px; 46 | color: $c; 47 | border-right: 1px solid $c; 48 | transform: scaleX(0.5); 49 | transform-origin: 100% 0; 50 | content: ""; 51 | } 52 | -------------------------------------------------------------------------------- /packages/we-vue/src/scss/base/mixin/text.scss: -------------------------------------------------------------------------------- 1 | @mixin ellipsis($w: auto) { 2 | width: $w; 3 | overflow: hidden; 4 | white-space: nowrap; 5 | text-overflow: ellipsis; 6 | word-wrap: normal; 7 | } 8 | 9 | @mixin ellipsisLn($line) { 10 | display: -webkit-box; 11 | overflow: hidden; 12 | text-overflow: ellipsis; 13 | -webkit-box-orient: vertical; 14 | -webkit-line-clamp: $line; 15 | } 16 | 17 | @mixin text_wrap() { 18 | word-wrap: break-word; 19 | word-break: break-all; 20 | } 21 | 22 | @mixin hyphens() { 23 | word-wrap: break-word; 24 | -webkit-hyphens: auto; 25 | hyphens: auto; 26 | } 27 | -------------------------------------------------------------------------------- /packages/we-vue/src/scss/base/reset.scss: -------------------------------------------------------------------------------- 1 | @import "fn"; 2 | 3 | html { 4 | -ms-text-size-adjust: 100%; 5 | -webkit-text-size-adjust: 100%; 6 | } 7 | 8 | body { 9 | font-family: $weui-font-default; 10 | line-height: 1.6; 11 | } 12 | 13 | * { 14 | margin: 0; 15 | padding: 0; 16 | } 17 | 18 | a img { 19 | border: 0; 20 | } 21 | 22 | a { 23 | text-decoration: none; 24 | 25 | @include setTapColor(); 26 | } 27 | -------------------------------------------------------------------------------- /packages/we-vue/src/scss/base/variable/color.scss: -------------------------------------------------------------------------------- 1 | // color 2 | $weui-color-primary: #1aad19; 3 | $weui-color-warn: #e64340; 4 | 5 | // link 6 | $weui-link-color-default: #586c94; 7 | 8 | // background 9 | $weui-bg-color-default: #efeff4; 10 | $weui-bg-color-active: #ececec; 11 | 12 | // line 13 | $weui-line-color-light: #e5e5e5; 14 | $weui-line-color-dark: #bcbab6; 15 | 16 | // text 17 | $weui-text-color-title: #000; 18 | $weui-text-color-tips: #b2b2b2; 19 | $weui-text-color-warn: $weui-color-warn; 20 | $weui-text-color-gray: #999; 21 | -------------------------------------------------------------------------------- /packages/we-vue/src/scss/base/variable/global.scss: -------------------------------------------------------------------------------- 1 | // font 2 | $weui-font-en: -apple-system-font, "Helvetica Neue"; 3 | $weui-font-cn: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei"; 4 | $weui-font-sans: sans-serif; 5 | $weui-font-default: $weui-font-en, $weui-font-sans; 6 | -------------------------------------------------------------------------------- /packages/we-vue/src/scss/base/variable/weui-cell.scss: -------------------------------------------------------------------------------- 1 | $weui-cell-bg: #fff; 2 | $weui-cell-border-color: #e5e5e5; 3 | $weui-cell-gap-v: 10px; 4 | $weui-cell-gap-h: 15px; 5 | $weui-cell-inner-gap-h: 0.35em; 6 | $weui-cell-height: 45px; 7 | $weui-cell-font-size: 17px; 8 | $weui-cell-tips-font-size: 14px; 9 | $weui-cell-label-width: 105px; 10 | 11 | $weui-cell-line-height: ($weui-cell-height - 2 * $weui-cell-gap-v) / $weui-cell-font-size; // 高度减去上下padding的行高 12 | $weui-cells-margin-top: (20px / $weui-cell-font-size) + em; 13 | 14 | // weui switch 15 | $weui-switch-height: 32px; 16 | 17 | // weui uploader 18 | $weui-uploader-border-color: #d9d9d9; 19 | $weui-uploader-active-border-color: #999; 20 | $weui-uploader-file-spacing: 9px; 21 | $weui-uploader-size: 79px; 22 | $weui-uploader-border-width: 1px; 23 | -------------------------------------------------------------------------------- /packages/we-vue/src/scss/base/variable/weui-dialog.scss: -------------------------------------------------------------------------------- 1 | $weui-dialog-background-color: #fff; 2 | $weui-dialog-line-color: #d5d5d6; 3 | $weui-dialog-link-color: #3cc51f; 4 | $weui-dialog-link-active-bc: #eee; 5 | $weui-dialog-gap-width: 1.6em; 6 | -------------------------------------------------------------------------------- /packages/we-vue/src/scss/base/variable/weui-grid.scss: -------------------------------------------------------------------------------- 1 | $weui-grid-border-color: #d9d9d9; 2 | $weui-grid-font-size: 14px; 3 | $weui-grid-icon-size: 28px; 4 | $weui-grid-column-count: 3; 5 | -------------------------------------------------------------------------------- /packages/we-vue/src/scss/base/variable/weui-msg.scss: -------------------------------------------------------------------------------- 1 | $weui-msg-padding-top: 36px; 2 | $weui-msg-icon-gap: 30px; 3 | $weui-msg-title-gap: 5px; 4 | $weui-msg-text-gap: 25px; 5 | $weui-msg-opr-gap: 25px; 6 | $weui-msg-extra-area-gap: 15px; 7 | $weui-msg-extra-area-of-min-height: 438px; 8 | -------------------------------------------------------------------------------- /packages/we-vue/src/scss/base/variable/weui-progress.scss: -------------------------------------------------------------------------------- 1 | $weui-progress-bg: #ebebeb; 2 | $weui-progress-color: #09bb07; 3 | $weui-progress-height: 3px; 4 | $weui-progress-close-bg: #ef4f4f; 5 | $weui-progress-active-bg: #c13e3e; 6 | -------------------------------------------------------------------------------- /packages/we-vue/src/scss/cell-swipe-button.scss: -------------------------------------------------------------------------------- 1 | @import "./base/fn"; 2 | 3 | .weui-swiped-btn { 4 | display: block; 5 | padding: $weui-cell-gap-v 1em; 6 | color: inherit; 7 | line-height: $weui-cell-line-height; 8 | } 9 | 10 | .weui-swiped-btn_default { 11 | background-color: #c7c7cc; 12 | } 13 | 14 | .weui-swiped-btn_warn { 15 | background-color: #ff3b30; 16 | } 17 | -------------------------------------------------------------------------------- /packages/we-vue/src/scss/cell-swipe.scss: -------------------------------------------------------------------------------- 1 | @import "./base/fn"; 2 | @import "./cell"; 3 | 4 | .weui-cell_swiped { 5 | display: block !important; 6 | padding: 0 !important; 7 | 8 | > .weui-cell__bd { 9 | position: relative; 10 | z-index: 1; 11 | background-color: #fff; 12 | } 13 | 14 | > .weui-cell__ft { 15 | position: absolute; 16 | top: 0; 17 | right: 0; 18 | bottom: 0; 19 | display: flex; 20 | color: #fff; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /packages/we-vue/src/scss/checklist.scss: -------------------------------------------------------------------------------- 1 | @import "./base/fn"; 2 | @import "./icon"; 3 | 4 | .weui-check__label { 5 | @include setTapColor(); 6 | 7 | &:active { 8 | background-color: #ececec; 9 | } 10 | } 11 | 12 | .weui-cells_checkbox { 13 | .weui-cell__hd { 14 | padding-right: $weui-cell-inner-gap-h; 15 | } 16 | 17 | .weui-icon-checked { 18 | &::before { 19 | display: block; 20 | color: #c9c9c9; 21 | font-size: 23px; 22 | content: "\EA01"; 23 | } 24 | 25 | &.checked { 26 | color: yellow; 27 | } 28 | 29 | &.checked::before { 30 | color: currentColor; // 为了实现自定义颜色 31 | content: "\EA06"; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /packages/we-vue/src/scss/circle.scss: -------------------------------------------------------------------------------- 1 | .wv-circle { 2 | display: block; 3 | } 4 | -------------------------------------------------------------------------------- /packages/we-vue/src/scss/datetime-picker.scss: -------------------------------------------------------------------------------- 1 | @import "./picker"; 2 | -------------------------------------------------------------------------------- /packages/we-vue/src/scss/flex.scss: -------------------------------------------------------------------------------- 1 | @import "./base/fn"; 2 | 3 | .weui-flex { 4 | display: flex; 5 | } 6 | 7 | .weui-flex__item { 8 | flex: 1; 9 | } 10 | -------------------------------------------------------------------------------- /packages/we-vue/src/scss/footer.scss: -------------------------------------------------------------------------------- 1 | @import "./base/fn"; 2 | 3 | .weui-footer { 4 | color: $weui-text-color-gray; 5 | font-size: 14px; 6 | text-align: center; 7 | 8 | a { 9 | color: $weui-link-color-default; 10 | } 11 | } 12 | 13 | .weui-footer_fixed-bottom { 14 | position: fixed; 15 | right: 0; 16 | bottom: 0.52em; 17 | left: 0; 18 | } 19 | 20 | .weui-footer__links { 21 | font-size: 0; 22 | } 23 | 24 | .weui-footer__link { 25 | position: relative; 26 | display: inline-block; 27 | margin: 0 0.62em; 28 | font-size: 14px; 29 | vertical-align: top; 30 | 31 | &::before { 32 | @include setLeftLine(); 33 | 34 | top: 0.36em; 35 | bottom: 0.36em; 36 | left: -0.65em; 37 | } 38 | 39 | &:first-child { 40 | &::before { 41 | display: none; 42 | } 43 | } 44 | } 45 | 46 | .weui-footer__text { 47 | padding: 0 0.34em; 48 | font-size: 12px; 49 | } 50 | -------------------------------------------------------------------------------- /packages/we-vue/src/scss/grid.scss: -------------------------------------------------------------------------------- 1 | @import "./base/fn"; 2 | 3 | .weui-grids { 4 | position: relative; 5 | overflow: hidden; 6 | 7 | &::before { 8 | @include setTopLine($weui-grid-border-color); 9 | } 10 | 11 | &::after { 12 | @include setLeftLine($weui-grid-border-color); 13 | } 14 | } 15 | 16 | .weui-grid { 17 | position: relative; 18 | float: left; 19 | box-sizing: border-box; 20 | width: 100% / $weui-grid-column-count; 21 | padding: 20px 10px; 22 | 23 | &::before { 24 | @include setRightLine($weui-grid-border-color); 25 | } 26 | 27 | &::after { 28 | @include setBottomLine($weui-grid-border-color); 29 | } 30 | 31 | &:active { 32 | background-color: $weui-bg-color-active; 33 | } 34 | } 35 | 36 | .weui-grid__icon { 37 | width: $weui-grid-icon-size; 38 | height: $weui-grid-icon-size; 39 | margin: 0 auto; 40 | 41 | img { 42 | display: block; 43 | width: 100%; 44 | height: 100%; 45 | } 46 | 47 | & + .weui-grid__label { 48 | margin-top: 5px; 49 | } 50 | } 51 | 52 | .weui-grid__label { 53 | display: block; 54 | overflow: hidden; 55 | color: $weui-text-color-title; 56 | font-size: $weui-grid-font-size; 57 | white-space: nowrap; 58 | text-align: center; 59 | text-overflow: ellipsis; 60 | } 61 | -------------------------------------------------------------------------------- /packages/we-vue/src/scss/group.scss: -------------------------------------------------------------------------------- 1 | @import "./base/fn"; 2 | 3 | .weui-cells { 4 | 5 | // onepx 6 | position: relative; 7 | margin-top: $weui-cells-margin-top; 8 | overflow: hidden; // 因为每个 cell 的 border 使用 before 元素 left 搞的,ie下伪元素的containing block估计跟标准不同,在cell上用oh不生效 9 | font-size: $weui-cell-font-size; // cell 中间有效高度23px,跟客户端默认图标尺寸一致 10 | line-height: $weui-cell-line-height; 11 | background-color: $weui-cell-bg; 12 | 13 | &::before { 14 | @include setTopLine($weui-cell-border-color); 15 | 16 | z-index: 2; 17 | } 18 | 19 | &::after { 20 | @include setBottomLine($weui-cell-border-color); 21 | 22 | z-index: 2; 23 | } 24 | } 25 | 26 | .weui-cells__title { 27 | margin-top: 0.77em; // 15px - 行高 28 | margin-bottom: 0.3em; // 8px - 行高 29 | padding-right: $weui-cell-gap-h; 30 | padding-left: $weui-cell-gap-h; 31 | color: $weui-text-color-gray; 32 | font-size: $weui-cell-tips-font-size; 33 | 34 | & + .weui-cells { 35 | margin-top: 0; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /packages/we-vue/src/scss/header.scss: -------------------------------------------------------------------------------- 1 | @import "./base/fn"; 2 | 3 | $headerHeight: 50px; 4 | 5 | .wv-header { 6 | position: relative; 7 | z-index: 500; 8 | display: flex; 9 | align-items: center; 10 | box-sizing: border-box; 11 | width: 100%; 12 | height: $headerHeight; 13 | margin: 0; 14 | padding: 0 10px; 15 | color: white; 16 | line-height: 1; 17 | white-space: nowrap; 18 | 19 | .left { 20 | display: block; 21 | float: left; 22 | overflow: hidden; 23 | font-weight: 100; 24 | font-size: 35px; 25 | line-height: 35px; 26 | } 27 | 28 | .wv-header-title { 29 | flex: 1; 30 | font-size: 23px; 31 | text-align: center; 32 | } 33 | 34 | &.is-fixed { 35 | position: fixed; 36 | top: 0; 37 | left: 0; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /packages/we-vue/src/scss/index.scss: -------------------------------------------------------------------------------- 1 | /* base */ 2 | @import "./base"; 3 | 4 | /* common components */ 5 | @import "./actionsheet"; 6 | @import "./badge"; 7 | @import "./button"; 8 | @import "./cell-swipe-button"; 9 | @import "./cell-swipe"; 10 | @import "./cell"; 11 | @import "./checklist"; 12 | @import "./circle"; 13 | @import "./datetime-picker"; 14 | @import "./dialog"; 15 | @import "./flex"; 16 | @import "./footer"; 17 | @import "./form-preview"; 18 | @import "./grid"; 19 | @import "./group"; 20 | @import "./header"; 21 | @import "./icon"; 22 | @import "./input"; 23 | @import "./loadmore"; 24 | @import "./media-box"; 25 | @import "./number-spinner"; 26 | @import "./panel"; 27 | @import "./picker"; 28 | @import "./popup"; 29 | @import "./progress"; 30 | @import "./radio"; 31 | @import "./search-bar"; 32 | @import "./slider"; 33 | @import "./spinner"; 34 | @import "./swipe"; 35 | @import "./switch"; 36 | @import "./tabbar"; 37 | @import "./tabs"; 38 | @import "./textarea"; 39 | @import "./toast"; 40 | @import "./top-tips"; 41 | -------------------------------------------------------------------------------- /packages/we-vue/src/scss/input.scss: -------------------------------------------------------------------------------- 1 | @import "./base/fn"; 2 | @import "./cell"; 3 | 4 | .weui-input { 5 | width: 100%; 6 | height: $weui-cell-line-height + em; 7 | color: inherit; 8 | font-size: inherit; 9 | line-height: $weui-cell-line-height; 10 | background-color: transparent; 11 | border: 0; 12 | outline: 0; 13 | -webkit-appearance: none; 14 | 15 | // hides the spin-button 16 | &::-webkit-outer-spin-button, 17 | &::-webkit-inner-spin-button { 18 | margin: 0; 19 | -webkit-appearance: none; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /packages/we-vue/src/scss/loadmore.scss: -------------------------------------------------------------------------------- 1 | @import "./base/fn"; 2 | 3 | .weui-loadmore { 4 | width: 65%; 5 | margin: 1.5em auto; 6 | font-size: 14px; 7 | line-height: 1.6em; 8 | text-align: center; 9 | } 10 | 11 | .weui-loadmore__tips { 12 | display: inline-block; 13 | vertical-align: middle; 14 | } 15 | 16 | .weui-loadmore_line { 17 | margin-top: 2.4em; 18 | border-top: 1px solid $weui-line-color-light; 19 | 20 | .weui-loadmore__tips { 21 | position: relative; 22 | top: -0.9em; 23 | padding: 0 0.55em; 24 | color: $weui-text-color-gray; 25 | background-color: #fff; 26 | } 27 | } 28 | 29 | .weui-loadmore_dot { 30 | .weui-loadmore__tips { 31 | padding: 0 0.16em; 32 | 33 | &::before { 34 | position: relative; 35 | top: -0.16em; 36 | display: inline-block; 37 | width: 4px; 38 | height: 4px; 39 | vertical-align: 0; 40 | background-color: $weui-line-color-light; 41 | border-radius: 50%; 42 | content: ""; 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /packages/we-vue/src/scss/panel.scss: -------------------------------------------------------------------------------- 1 | @import "./base/fn"; 2 | 3 | .weui-panel { 4 | position: relative; 5 | margin-top: 10px; 6 | overflow: hidden; 7 | background-color: #fff; 8 | 9 | &:first-child { 10 | margin-top: 0; 11 | } 12 | 13 | &::before { 14 | @include setTopLine($weui-line-color-light); 15 | } 16 | 17 | &::after { 18 | @include setBottomLine($weui-line-color-light); 19 | } 20 | } 21 | 22 | .weui-panel__hd { 23 | position: relative; 24 | padding: 14px 15px 10px; 25 | color: $weui-text-color-gray; 26 | font-size: 13px; 27 | 28 | &::after { 29 | @include setBottomLine($weui-line-color-light); 30 | 31 | left: 15px; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /packages/we-vue/src/scss/popup.scss: -------------------------------------------------------------------------------- 1 | @import "./base/fn"; 2 | 3 | .wv { 4 | &-modal { 5 | position: fixed; 6 | top: 0; 7 | left: 0; 8 | width: 100%; 9 | height: 100%; 10 | } 11 | 12 | &-overflow-hidden { 13 | overflow: hidden !important; 14 | } 15 | 16 | &-popup { 17 | position: fixed; 18 | bottom: 0; 19 | left: 0; 20 | width: 100%; 21 | background-color: white; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/we-vue/src/scss/progress.scss: -------------------------------------------------------------------------------- 1 | @import "./base/fn"; 2 | 3 | .weui-progress { 4 | display: flex; 5 | align-items: center; 6 | 7 | &__bar { 8 | //background-color: $weui-progress-bg; 9 | //height: $weui-progress-height; 10 | flex: 1; 11 | } 12 | 13 | &__inner-bar { 14 | width: 0; 15 | height: 100%; 16 | //background-color: $weui-progress-color; 17 | } 18 | 19 | &__opr { 20 | display: block; 21 | margin-left: 15px; 22 | font-size: 0; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /packages/we-vue/src/scss/radio.scss: -------------------------------------------------------------------------------- 1 | @import "./base/fn"; 2 | @import "./icon"; 3 | 4 | .weui-check__label { 5 | @include setTapColor(); 6 | 7 | &:active { 8 | background-color: #ececec; 9 | } 10 | } 11 | 12 | // method2 accessbility 13 | .weui-cells_radio { 14 | .weui-cell__ft { 15 | padding-left: $weui-cell-inner-gap-h; 16 | 17 | .weui-icon-checked { 18 | &::before { 19 | display: block; 20 | color: #09bb07; 21 | font-size: 16px; 22 | content: "\EA08"; 23 | } 24 | } 25 | } 26 | } 27 | 28 | .weui-check__label-disabled { 29 | background-color: rgba(0, 0, 0, 0.1); 30 | } 31 | -------------------------------------------------------------------------------- /packages/we-vue/src/scss/slider.scss: -------------------------------------------------------------------------------- 1 | @import "./base/fn"; 2 | 3 | .weui-slider { 4 | padding: 15px 18px; 5 | user-select: none; 6 | } 7 | 8 | .weui-slider__inner { 9 | position: relative; 10 | height: 2px; 11 | background-color: #e9e9e9; 12 | } 13 | 14 | .weui-slider__track { 15 | width: 0; 16 | height: 2px; 17 | background-color: $weui-color-primary; 18 | } 19 | 20 | .weui-slider__handler { 21 | position: absolute; 22 | top: 50%; 23 | left: 0; 24 | width: 28px; 25 | height: 28px; 26 | margin-top: -14px; 27 | margin-left: -14px; 28 | background-color: #fff; 29 | border-radius: 50%; 30 | box-shadow: 0 0 4px rgba(0, 0, 0, 0.2); 31 | } 32 | 33 | .weui-slider-box { 34 | display: flex; 35 | align-items: center; 36 | 37 | .weui-slider { 38 | flex: 1; 39 | } 40 | } 41 | 42 | .weui-slider-box__value { 43 | min-width: 24px; 44 | margin-left: 0.5em; 45 | color: #888; 46 | font-size: 14px; 47 | text-align: center; 48 | } 49 | 50 | .wv-slider--disabled { 51 | opacity: 0.5; 52 | } 53 | -------------------------------------------------------------------------------- /packages/we-vue/src/scss/swipe.scss: -------------------------------------------------------------------------------- 1 | @import "./base/fn"; 2 | 3 | $wv-swipe-indicator: 6px; 4 | 5 | .wv-swipe { 6 | position: relative; 7 | overflow: hidden; 8 | user-select: none; 9 | 10 | &__wrapper { 11 | height: 100%; 12 | } 13 | 14 | &__indicators { 15 | position: absolute; 16 | bottom: 10px; 17 | left: 50%; 18 | height: $wv-swipe-indicator; 19 | transform: translate3d(-50%, 0, 0); 20 | 21 | > i { 22 | display: inline-block; 23 | width: $wv-swipe-indicator; 24 | height: $wv-swipe-indicator; 25 | vertical-align: top; 26 | background-color: gray; 27 | border-radius: 100%; 28 | 29 | &:not(:last-child) { 30 | margin-right: $wv-swipe-indicator; 31 | } 32 | } 33 | 34 | .wv-swipe__indicator { 35 | &--active { 36 | background-color: white; 37 | } 38 | } 39 | } 40 | } 41 | 42 | .wv-swipe-item { 43 | float: left; 44 | height: 100%; 45 | } 46 | -------------------------------------------------------------------------------- /packages/we-vue/src/scss/tabbar.scss: -------------------------------------------------------------------------------- 1 | @import "./base/fn"; 2 | 3 | .weui-tabbar { 4 | position: absolute; 5 | bottom: 0; 6 | z-index: 500; 7 | display: flex; 8 | width: 100%; 9 | background-color: #f7f7fa; 10 | 11 | &::before { 12 | @include setTopLine(#c0bfc4); 13 | } 14 | } 15 | 16 | .weui-tabbar__item { 17 | display: block; 18 | flex: 1; 19 | padding: 5px 0 0; 20 | color: $weui-text-color-gray; 21 | font-size: 0; 22 | text-align: center; 23 | 24 | @include setTapColor(); 25 | 26 | &.weui-bar__item_on { 27 | .weui-tabbar__icon, 28 | .weui-tabbar__icon > i, 29 | .weui-tabbar__label { 30 | color: #09bb07; 31 | } 32 | } 33 | } 34 | 35 | .weui-tabbar__icon { 36 | display: inline-block; 37 | width: 27px; 38 | height: 27px; 39 | 40 | &i, 41 | > i { 42 | color: $weui-text-color-gray; 43 | font-size: 24px; 44 | } 45 | 46 | img { 47 | width: 100%; 48 | height: 100%; 49 | } 50 | } 51 | 52 | .weui-tabbar__label { 53 | color: $weui-text-color-gray; 54 | font-size: 10px; 55 | line-height: 1.8; 56 | text-align: center; 57 | } 58 | -------------------------------------------------------------------------------- /packages/we-vue/src/scss/textarea.scss: -------------------------------------------------------------------------------- 1 | @import "./base/fn"; 2 | 3 | .weui-textarea { 4 | display: block; 5 | width: 100%; 6 | color: inherit; 7 | font-size: 1em; 8 | line-height: inherit; 9 | border: 0; 10 | outline: 0; 11 | resize: none; 12 | } 13 | 14 | .weui-textarea-counter { 15 | color: $weui-text-color-tips; 16 | text-align: right; 17 | 18 | .weui-cell_warn & { 19 | color: $weui-text-color-warn; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /packages/we-vue/src/scss/top-tips.scss: -------------------------------------------------------------------------------- 1 | @import "./base/fn"; 2 | 3 | .weui-toptips { 4 | position: fixed; 5 | top: 0; 6 | right: 0; 7 | left: 0; 8 | z-index: 5000; 9 | display: block; 10 | padding: 5px; 11 | color: #fff; 12 | font-size: 14px; 13 | text-align: center; 14 | transform: translateZ(0); 15 | 16 | @include text_wrap(); 17 | 18 | &_warn { 19 | background-color: $weui-color-warn; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /packages/we-vue/src/shims-tsx.d.ts: -------------------------------------------------------------------------------- 1 | import Vue, { VNode } from 'vue' 2 | 3 | declare global { 4 | namespace JSX { 5 | // tslint:disable no-empty-interface 6 | interface Element extends VNode {} 7 | // tslint:disable no-empty-interface 8 | interface ElementClass extends Vue {} 9 | interface IntrinsicElements { 10 | [elem: string]: any 11 | } 12 | // TODO: 仅为关闭 TSX 中的部分类型检查,有更好方案时去掉这个 13 | type LibraryManagedAttributes = {[name: string]: any} 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/we-vue/src/utils/event.ts: -------------------------------------------------------------------------------- 1 | import { isServer } from './' 2 | 3 | type EventHandler = (event: Event) => void 4 | 5 | export let supportsPassive = false 6 | 7 | if (!isServer) { 8 | try { 9 | const opts = {} 10 | Object.defineProperty(opts, 'passive', { 11 | get () { 12 | /* istanbul ignore next */ 13 | supportsPassive = true 14 | }, 15 | }) 16 | window.addEventListener('test-passive', null as any, opts) 17 | } catch (e) {} 18 | } 19 | 20 | export function on (target: Element | Window | Document, event: string, handler: EventHandler, passive = false) { 21 | !isServer && 22 | target.addEventListener( 23 | event, 24 | handler, 25 | supportsPassive ? { capture: false, passive } : false 26 | ) 27 | } 28 | 29 | export function off (target: Element | Window | Document, event: string, handler: EventHandler) { 30 | !isServer && target.removeEventListener(event, handler) 31 | } 32 | -------------------------------------------------------------------------------- /packages/we-vue/src/utils/index.ts: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import { getTouch } from './touches' 3 | 4 | const isServer: boolean = Vue.prototype.$isServer 5 | 6 | /** 7 | * whether the value is defined 8 | * @param v 9 | */ 10 | function isDef (v: any): boolean { 11 | return v !== undefined && v !== null 12 | } 13 | 14 | /** 15 | * whether the value is a type of object 16 | * @param v 17 | */ 18 | function isObj (v: any): boolean { 19 | const type = typeof v 20 | return v !== null && (type === 'object' || type === 'function') 21 | } 22 | 23 | export { isServer, getTouch, isDef, isObj } 24 | -------------------------------------------------------------------------------- /packages/we-vue/src/utils/mixins.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable max-len, import/export, no-use-before-define */ 2 | import Vue, { VueConstructor } from 'vue' 3 | 4 | export default function mixins (...args: T): ExtractVue extends infer V ? V extends Vue ? VueConstructor : never : never 5 | export default function mixins (...args: VueConstructor[]): VueConstructor 6 | export default function mixins (...args: VueConstructor[]): VueConstructor { 7 | return Vue.extend({ mixins: args }) 8 | } 9 | 10 | /** 11 | * Returns the instance type from a VueConstructor 12 | * Useful for adding types when using mixins().extend() 13 | */ 14 | export type ExtractVue = T extends Array 15 | ? UnionToIntersection ? V : never> 16 | : T extends VueConstructor ? V : never 17 | 18 | type UnionToIntersection = 19 | (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never 20 | -------------------------------------------------------------------------------- /packages/we-vue/src/utils/raf.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * requestAnimationFrame polyfill 3 | */ 4 | 5 | let prev = Date.now() 6 | 7 | /* istanbul ignore next */ 8 | function fallback (fn: FrameRequestCallback): number { 9 | const curr = Date.now() 10 | const ms = Math.max(0, 16 - (curr - prev)) 11 | const id = setTimeout(fn, ms) 12 | prev = curr + ms 13 | return id 14 | } 15 | 16 | /* istanbul ignore next */ 17 | // const root: Global | Window = isServer ? global : window 18 | const root = window 19 | 20 | /* istanbul ignore next */ 21 | const iRaf = root.requestAnimationFrame || root.webkitRequestAnimationFrame || fallback 22 | 23 | /* istanbul ignore next */ 24 | const iCancel = root.cancelAnimationFrame || root.webkitCancelAnimationFrame || root.clearTimeout 25 | 26 | export function raf (fn: FrameRequestCallback): number { 27 | return iRaf.call(root, fn) 28 | } 29 | 30 | export function cancel (id: number) { 31 | iCancel.call(root, id) 32 | } 33 | -------------------------------------------------------------------------------- /packages/we-vue/src/utils/touches.ts: -------------------------------------------------------------------------------- 1 | function getTouch (event: TouchEvent): Touch { 2 | return event.changedTouches[0] || event.touches[0] 3 | } 4 | 5 | export { getTouch } 6 | -------------------------------------------------------------------------------- /packages/we-vue/test/unit/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "jest": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /packages/we-vue/test/unit/setup.ts: -------------------------------------------------------------------------------- 1 | // polyfill 是必要的,否则使用 async 函数会报错 2 | // 也可以考虑对于测试使用 transform-runtime 3 | import '@babel/polyfill' 4 | import Vue from 'vue' 5 | import { config } from '@vue/test-utils' 6 | 7 | Vue.config.silent = true 8 | 9 | // IMPORTANT: DO NOT use vue-test-utils transitionStub 10 | ;(config.stubs as any).transition = false 11 | ;(config.stubs as any)['transition-group'] = false 12 | -------------------------------------------------------------------------------- /packages/we-vue/tsconfig.dist.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "target": "esnext", 5 | "module": "esnext", 6 | "outDir": "./lib-temp", 7 | "sourceMap": false, 8 | "inlineSourceMap": true, 9 | "inlineSources": true 10 | }, 11 | "exclude": [ 12 | "node_modules", 13 | "**/*.spec.ts", 14 | "**/*.spec.js" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /packages/we-vue/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": [ 4 | "src" 5 | ], 6 | "compilerOptions": { 7 | "baseUrl": ".", 8 | "paths": { 9 | "@/test/*": ["test/*"], 10 | "@/*": ["src/*"] 11 | }, 12 | "types": [ 13 | "jest", 14 | "faker", 15 | "dom-inputevent" 16 | ] 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/we-vue/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "defaultSeverity": "error", 3 | "extends": "typestrict", 4 | "linterOptions": { 5 | "exclude": [ 6 | "**/*.spec.js", 7 | "**/node_modules/**/*" 8 | ] 9 | }, 10 | "jsRules": {}, 11 | "rules": { 12 | // IMPOTRANT: enforces use of T[] if T is a simple type (primitive or type reference). 13 | "array-type": [true, "array-simple"], 14 | "use-type-alias": true, 15 | "no-inferrable-types": true, 16 | "unified-signatures": true, 17 | "no-undefined-argument": true, 18 | 19 | "use-default-type-parameter": true, 20 | 21 | /* typestrict overrides */ 22 | 23 | // Handled by tsc 24 | "no-unused-variable": false, 25 | 26 | // Useless with vue 27 | "no-invalid-this": false, 28 | 29 | // Retarded 30 | "restrict-plus-operands": false, 31 | 32 | // Fails with no-unused-variable for some reason 33 | "no-useless-cast": false, 34 | 35 | "no-floating-promises": false, 36 | "promise-must-complete": false 37 | }, 38 | "rulesDirectory": [] 39 | } 40 | -------------------------------------------------------------------------------- /packages/we-vue/types/index.d.ts: -------------------------------------------------------------------------------- 1 | import Vue, { Component, DirectiveOptions, PluginFunction } from 'vue' 2 | 3 | import './lib' 4 | 5 | declare const WeVue: WeVue 6 | export default WeVue 7 | export interface WeVue { 8 | install: PluginFunction 9 | version: string 10 | } 11 | 12 | /* eslint-disable-next-line */ 13 | export type WeVueComponents = Component & { $_we_vue_subcomponents?: Record } 14 | 15 | export interface WeVueUseOptions { 16 | directives?: Record 17 | components?: Record 18 | plugins?: Record> 19 | } 20 | 21 | export interface WeVueObject extends Vue { 22 | // TODO 23 | } 24 | 25 | declare module 'vue/types/vue' { 26 | export interface Vue { 27 | $wevue: WeVueObject 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /packages/we-vue/types/test/lib.ts: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | 3 | import WvVue, { 4 | WvBadge, 5 | WvButton, 6 | directives, 7 | } from 'we-vue/lib' 8 | 9 | WvVue.install(Vue, { 10 | components: { 11 | WvBadge, 12 | WvButton, 13 | }, 14 | directives, 15 | }) 16 | -------------------------------------------------------------------------------- /packages/we-vue/types/test/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": [ 5 | "dom", 6 | "es2015" 7 | ], 8 | "module": "commonjs", 9 | "strict": true, 10 | "noEmit": true, 11 | "baseUrl": ".", 12 | "paths": { 13 | "we-vue": ["../../"] 14 | } 15 | }, 16 | "files": [ 17 | "../index.d.ts", 18 | "../lib.d.ts", 19 | "lib.ts" 20 | ], 21 | "compileOnSave": false 22 | } 23 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "esnext", 4 | "module": "esnext", 5 | "lib": [ 6 | "esnext", 7 | "dom", 8 | "dom.iterable", 9 | "scripthost" 10 | ], 11 | "allowJs": true, 12 | "sourceMap": true, 13 | "outDir": "./dist", 14 | "downlevelIteration": true, 15 | "strict": true, 16 | "jsx": "preserve", 17 | "noUnusedLocals": true, 18 | "noImplicitReturns": true, 19 | "moduleResolution": "node", 20 | "esModuleInterop": true, 21 | "allowSyntheticDefaultImports": true, 22 | "importHelpers": true, 23 | "declaration": false, 24 | "experimentalDecorators": true, 25 | "emitDecoratorMetadata": true, 26 | "types": [ 27 | "jest" 28 | ] 29 | }, 30 | "exclude": [ 31 | "node_modules" 32 | ] 33 | } 34 | --------------------------------------------------------------------------------