From ba5b77568b1d1b2a8cbb69c0b284ae2c0782d316 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=8E=AB=E5=94=90=E5=B0=BC?= Date: Mon, 31 Aug 2026 07:58:23 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=9E=B6=E6=9E=84=E5=8D=87?= =?UTF-8?q?=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .agents/README.md | 40 + .agents/bak-skills/uniapp-ad/LICENSE.txt | 21 + .agents/bak-skills/uniapp-ad/SKILL.md | 108 + .agents/bak-skills/uniapp-ad/api/ad-api.md | 15 + .../uniapp-ad/examples/ad-types/banner.md | 17 + .../examples/ad-types/interstitial.md | 18 + .../uniapp-ad/examples/ad-types/native.md | 14 + .../examples/ad-types/rewarded-video.md | 18 + .../uniapp-ad/examples/guide/intro.md | 20 + .../uniapp-ad/examples/integration/config.md | 14 + .../uniapp-ad/examples/integration/events.md | 23 + .agents/bak-skills/uniapp-cloud/LICENSE.txt | 21 + .agents/bak-skills/uniapp-cloud/SKILL.md | 113 + .../bak-skills/uniapp-cloud/api/cloud-api.md | 121 + .../uniapp-cloud/examples/database/crud.md | 45 + .../uniapp-cloud/examples/database/indexes.md | 19 + .../examples/database/permissions.md | 23 + .../uniapp-cloud/examples/database/query.md | 40 + .../uniapp-cloud/examples/datacom/intro.md | 18 + .../examples/functions/call-function.md | 20 + .../examples/functions/create-function.md | 25 + .../examples/guide/cloud-space.md | 28 + .../uniapp-cloud/examples/guide/intro.md | 104 + .../examples/guide/project-setup.md | 40 + .../uniapp-cloud/examples/security/rules.md | 24 + .../uniapp-cloud/examples/storage/delete.md | 17 + .../uniapp-cloud/examples/storage/download.md | 19 + .../uniapp-cloud/examples/storage/upload.md | 20 + .../bak-skills/uniapp-mini-guide/LICENSE.txt | 21 + .agents/bak-skills/uniapp-mini-guide/SKILL.md | 87 + .../examples/api/overview.md | 14 + .../examples/components/overview.md | 14 + .../examples/guide/config.md | 15 + .../uniapp-mini-guide/examples/guide/intro.md | 20 + .../bak-skills/uniapp-native-app/LICENSE.txt | 21 + .agents/bak-skills/uniapp-native-app/SKILL.md | 105 + .../examples/android/build.md | 15 + .../examples/android/keystore.md | 15 + .../examples/android/signing.md | 15 + .../uniapp-native-app/examples/guide/intro.md | 29 + .../examples/guide/offline-packaging.md | 21 + .../examples/ios/provisioning.md | 14 + .../uniapp-native-app/examples/ios/signing.md | 15 + .../templates/build-config.md | 18 + .../uniapp-native-plugin/LICENSE.txt | 21 + .../bak-skills/uniapp-native-plugin/SKILL.md | 105 + .../examples/android-plugin/native-api.md | 14 + .../examples/android-plugin/project-setup.md | 15 + .../examples/guide/bridge.md | 14 + .../examples/guide/intro.md | 31 + .../examples/guide/structure.md | 20 + .../examples/ios-plugin/native-api.md | 14 + .../examples/ios-plugin/project-setup.md | 15 + .../templates/plugin-template.md | 15 + .agents/bak-skills/uniapp-plugin/LICENSE.txt | 21 + .agents/bak-skills/uniapp-plugin/SKILL.md | 108 + .../uniapp-plugin/examples/guide/intro.md | 14 + .../examples/installation/hbuilderx.md | 15 + .../examples/installation/marketplace.md | 15 + .../examples/plugin-types/api.md | 14 + .../examples/plugin-types/component.md | 14 + .../examples/plugin-types/template.md | 14 + .../uniapp-plugin/templates/plugin-usage.md | 16 + .../uniapp-project-creator/SKILL.md | 123 + .../examples/guide/installation.md | 119 + .../examples/guide/project-types.md | 216 + .../examples/guide/quick-start.md | 272 + .../templates/cli-commands.md | 294 + .../templates/project-templates.md | 501 + .agents/bak-skills/uniapp-ucharts/LICENSE.txt | 202 + .agents/bak-skills/uniapp-ucharts/SKILL.md | 157 + .../uniapp-ucharts/api/config-api.md | 167 + .../uniapp-ucharts/api/integration-api.md | 153 + .../examples/advanced/build-optimization.md | 100 + .../examples/advanced/custom-theme.md | 117 + .../examples/advanced/multi-platform.md | 105 + .../getting-started/easycom-config.md | 196 + .../examples/getting-started/installation.md | 226 + .../examples/getting-started/project-setup.md | 246 + .../examples/integration/manifest-config.md | 163 + .../examples/integration/navigation.md | 165 + .../examples/integration/pages-config.md | 152 + .../examples/integration/uni-api.md | 246 + .../examples/platform-specific/app.md | 106 + .../examples/platform-specific/h5.md | 126 + .../examples/platform-specific/miniprogram.md | 140 + .../examples/platform-specific/nvue.md | 91 + .../templates/basic-uniapp-project.md | 206 + .../templates/manifest-template.md | 86 + .../templates/pages-template.md | 74 + .agents/bak-skills/uniapp-uview/SKILL.md | 156 + .../bak-skills/uniapp-uview/api/config-api.md | 187 + .../uniapp-uview/api/integration-api.md | 179 + .../examples/advanced/build-optimization.md | 97 + .../examples/advanced/custom-theme.md | 96 + .../examples/advanced/multi-platform.md | 97 + .../getting-started/easycom-config.md | 170 + .../examples/getting-started/installation.md | 171 + .../examples/getting-started/project-setup.md | 264 + .../examples/integration/manifest-config.md | 216 + .../examples/integration/navigation.md | 309 + .../examples/integration/pages-config.md | 263 + .../examples/integration/uni-api.md | 384 + .../examples/platform-specific/app.md | 118 + .../examples/platform-specific/h5.md | 159 + .../examples/platform-specific/miniprogram.md | 178 + .../examples/platform-specific/nvue.md | 93 + .../templates/basic-uniapp-project.md | 184 + .../templates/manifest-template.md | 86 + .../uniapp-uview/templates/pages-template.md | 85 + .../uniappx-project-creator/SKILL.md | 124 + .../examples/guide/installation.md | 192 + .../examples/guide/project-types.md | 156 + .../examples/guide/quick-start.md | 250 + .../templates/cli-commands.md | 129 + .../templates/project-templates.md | 245 + .../bak-skills/uniappx-project/LICENSE.txt | 21 + .agents/bak-skills/uniappx-project/SKILL.md | 101 + .../examples/api/device/get-battery-info.md | 178 + .../examples/api/device/get-network-type.md | 195 + .../api/device/get-screen-brightness.md | 192 + .../examples/api/device/get-system-info.md | 209 + .../api/device/set-screen-brightness.md | 195 + .../examples/api/file/get-file-info.md | 232 + .../examples/api/file/get-saved-file-list.md | 347 + .../examples/api/file/save-file.md | 223 + .../examples/api/location/choose-location.md | 299 + .../examples/api/location/get-location.md | 243 + .../examples/api/location/open-location.md | 188 + .../examples/api/media/choose-image.md | 222 + .../examples/api/media/choose-media.md | 232 + .../examples/api/media/choose-video.md | 233 + .../examples/api/media/get-image-info.md | 209 + .../examples/api/media/preview-image.md | 234 + .../api/media/save-image-to-photos-album.md | 274 + .../examples/api/navigation/navigate-back.md | 177 + .../examples/api/navigation/navigate-to.md | 151 + .../examples/api/navigation/re-launch.md | 152 + .../examples/api/navigation/redirect-to.md | 146 + .../examples/api/navigation/switch-tab.md | 149 + .../examples/api/network/download-file.md | 234 + .../examples/api/network/request.md | 287 + .../examples/api/network/upload-file.md | 262 + .../examples/api/storage/clear-storage.md | 137 + .../examples/api/storage/get-storage-info.md | 202 + .../examples/api/storage/get-storage-sync.md | 200 + .../examples/api/storage/get-storage.md | 175 + .../examples/api/storage/remove-storage.md | 160 + .../examples/api/storage/set-storage-sync.md | 196 + .../examples/api/storage/set-storage.md | 160 + .../examples/api/ui/hide-loading.md | 189 + .../api/ui/hide-navigation-bar-loading.md | 140 + .../examples/api/ui/hide-tab-bar-red-dot.md | 147 + .../examples/api/ui/hide-toast.md | 153 + .../examples/api/ui/remove-tab-bar-badge.md | 171 + .../api/ui/set-navigation-bar-color.md | 180 + .../api/ui/set-navigation-bar-title.md | 191 + .../examples/api/ui/set-tab-bar-badge.md | 205 + .../examples/api/ui/set-tab-bar-style.md | 168 + .../examples/api/ui/show-action-sheet.md | 217 + .../examples/api/ui/show-loading.md | 189 + .../examples/api/ui/show-modal.md | 226 + .../api/ui/show-navigation-bar-loading.md | 194 + .../examples/api/ui/show-tab-bar-red-dot.md | 199 + .../examples/api/ui/show-toast.md | 188 + .../examples/components/built-in/audio.md | 320 + .../examples/components/built-in/button.md | 233 + .../examples/components/built-in/camera.md | 347 + .../examples/components/built-in/canvas.md | 247 + .../examples/components/built-in/checkbox.md | 233 + .../examples/components/built-in/form.md | 321 + .../examples/components/built-in/icon.md | 160 + .../examples/components/built-in/image.md | 373 + .../examples/components/built-in/input.md | 331 + .../examples/components/built-in/label.md | 262 + .../examples/components/built-in/map.md | 326 + .../examples/components/built-in/navigator.md | 204 + .../examples/components/built-in/picker.md | 290 + .../examples/components/built-in/progress.md | 209 + .../examples/components/built-in/radio.md | 172 + .../examples/components/built-in/rich-text.md | 247 + .../components/built-in/scroll-view.md | 337 + .../examples/components/built-in/slider.md | 262 + .../examples/components/built-in/swiper.md | 294 + .../examples/components/built-in/switch.md | 277 + .../examples/components/built-in/text.md | 151 + .../examples/components/built-in/textarea.md | 261 + .../examples/components/built-in/video.md | 291 + .../examples/components/built-in/view.md | 407 + .../examples/components/built-in/web-view.md | 196 + .../uniappx-project/references/api/README.md | 174 + .../uniappx-project/references/api/device.md | 63 + .../uniappx-project/references/api/file.md | 35 + .../references/api/location.md | 59 + .../uniappx-project/references/api/media.md | 67 + .../references/api/navigation.md | 60 + .../uniappx-project/references/api/network.md | 276 + .../uniappx-project/references/api/other.md | 58 + .../uniappx-project/references/api/payment.md | 43 + .../uniappx-project/references/api/share.md | 25 + .../uniappx-project/references/api/storage.md | 65 + .../uniappx-project/references/api/ui.md | 75 + .../references/components/README.md | 48 + .../references/components/built-in/ad-draw.md | 32 + .../references/components/built-in/ad.md | 32 + .../references/components/built-in/audio.md | 112 + .../references/components/built-in/button.md | 240 + .../references/components/built-in/camera.md | 121 + .../references/components/built-in/canvas.md | 99 + .../components/built-in/checkbox.md | 198 + .../components/built-in/cover-image.md | 138 + .../components/built-in/cover-view.md | 34 + .../components/built-in/custom-tab-bar.md | 58 + .../references/components/built-in/editor.md | 252 + .../references/components/built-in/form.md | 238 + .../references/components/built-in/icon.md | 99 + .../references/components/built-in/image.md | 133 + .../references/components/built-in/input.md | 133 + .../references/components/built-in/label.md | 201 + .../components/built-in/live-player.md | 104 + .../components/built-in/live-pusher.md | 280 + .../references/components/built-in/map.md | 128 + .../components/built-in/match-media.md | 70 + .../components/built-in/movable-area.md | 34 + .../components/built-in/movable-view.md | 138 + .../components/built-in/navigation-bar.md | 131 + .../components/built-in/navigator.md | 141 + .../components/built-in/page-meta.md | 214 + .../components/built-in/picker-view.md | 154 + .../references/components/built-in/picker.md | 197 + .../components/built-in/progress.md | 147 + .../references/components/built-in/radio.md | 138 + .../components/built-in/rich-text.md | 117 + .../components/built-in/scroll-view.md | 228 + .../references/components/built-in/slider.md | 130 + .../references/components/built-in/swiper.md | 219 + .../references/components/built-in/switch.md | 121 + .../references/components/built-in/text.md | 121 + .../components/built-in/textarea.md | 230 + .../components/built-in/unicloud-db.md | 101 + .../references/components/built-in/video.md | 198 + .../references/components/built-in/view.md | 95 + .../components/built-in/web-view.md | 289 + .../bak-skills/uniappx-uview-pro/LICENSE.txt | 202 + .agents/bak-skills/uniappx-uview-pro/SKILL.md | 158 + .../uniappx-uview-pro/api/config-api.md | 114 + .../uniappx-uview-pro/api/integration-api.md | 168 + .../examples/advanced/build-optimization.md | 57 + .../examples/advanced/custom-theme.md | 55 + .../examples/advanced/multi-platform.md | 82 + .../getting-started/easycom-config.md | 183 + .../examples/getting-started/installation.md | 243 + .../examples/getting-started/project-setup.md | 263 + .../examples/integration/manifest-config.md | 227 + .../examples/integration/navigation.md | 292 + .../examples/integration/pages-config.md | 273 + .../examples/integration/uniappx-api.md | 233 + .../examples/platform-specific/app.md | 78 + .../examples/platform-specific/h5.md | 95 + .../examples/platform-specific/miniprogram.md | 118 + .../examples/platform-specific/nvue.md | 58 + .../templates/basic-uniappx-project.md | 150 + .../templates/manifest-template.md | 91 + .../templates/pages-template.md | 87 + .agents/skills/README.md | 7 + .agents/skills/uni-app/GENERATION.md | 54 + .agents/skills/uni-app/SKILL.md | 113 + .../uni-app/references/config-manifest.md | 370 + .../skills/uni-app/references/config-pages.md | 270 + .../references/core-form-components.md | 250 + .../uni-app/references/core-framework.md | 133 + .../references/core-view-components.md | 202 + .../references/feature-file-operations.md | 391 + .../uni-app/references/feature-lifecycle.md | 423 + .../uni-app/references/feature-location.md | 417 + .../references/feature-media-components.md | 314 + .../uni-app/references/feature-navigation.md | 257 + .../uni-app/references/feature-network.md | 345 + .../uni-app/references/feature-storage.md | 279 + .../uni-app/references/feature-system-info.md | 300 + .../uni-app/references/feature-ui-feedback.md | 382 + .agents/skills/uniapp-project/CHECKLIST.md | 317 + .agents/skills/uniapp-project/LICENSE.txt | 21 + .agents/skills/uniapp-project/SKILL.md | 234 + .agents/skills/uniapp-project/UPDATE_PLAN.md | 175 + .../examples/api/device/get-battery-info.md | 178 + .../examples/api/device/get-network-type.md | 195 + .../api/device/get-screen-brightness.md | 192 + .../examples/api/device/get-system-info.md | 209 + .../api/device/set-screen-brightness.md | 195 + .../examples/api/file/get-file-info.md | 232 + .../examples/api/file/get-saved-file-list.md | 347 + .../examples/api/file/save-file.md | 223 + .../examples/api/location/choose-location.md | 299 + .../examples/api/location/get-location.md | 243 + .../examples/api/location/open-location.md | 188 + .../examples/api/media/choose-image.md | 222 + .../examples/api/media/choose-media.md | 232 + .../examples/api/media/choose-video.md | 233 + .../examples/api/media/get-image-info.md | 209 + .../examples/api/media/preview-image.md | 234 + .../api/media/save-image-to-photos-album.md | 274 + .../examples/api/navigation/navigate-back.md | 177 + .../examples/api/navigation/navigate-to.md | 151 + .../examples/api/navigation/re-launch.md | 152 + .../examples/api/navigation/redirect-to.md | 146 + .../examples/api/navigation/switch-tab.md | 149 + .../examples/api/network/download-file.md | 234 + .../examples/api/network/request.md | 287 + .../examples/api/network/upload-file.md | 262 + .../examples/api/storage/clear-storage.md | 137 + .../examples/api/storage/get-storage-info.md | 202 + .../examples/api/storage/get-storage-sync.md | 200 + .../examples/api/storage/get-storage.md | 175 + .../examples/api/storage/remove-storage.md | 160 + .../examples/api/storage/set-storage-sync.md | 196 + .../examples/api/storage/set-storage.md | 160 + .../examples/api/ui/hide-loading.md | 189 + .../api/ui/hide-navigation-bar-loading.md | 140 + .../examples/api/ui/hide-tab-bar-red-dot.md | 147 + .../examples/api/ui/hide-toast.md | 153 + .../examples/api/ui/remove-tab-bar-badge.md | 171 + .../api/ui/set-navigation-bar-color.md | 180 + .../api/ui/set-navigation-bar-title.md | 191 + .../examples/api/ui/set-tab-bar-badge.md | 205 + .../examples/api/ui/set-tab-bar-style.md | 168 + .../examples/api/ui/show-action-sheet.md | 217 + .../examples/api/ui/show-loading.md | 189 + .../examples/api/ui/show-modal.md | 226 + .../api/ui/show-navigation-bar-loading.md | 194 + .../examples/api/ui/show-tab-bar-red-dot.md | 199 + .../examples/api/ui/show-toast.md | 188 + .../examples/components/built-in/audio.md | 320 + .../examples/components/built-in/button.md | 233 + .../examples/components/built-in/camera.md | 347 + .../examples/components/built-in/canvas.md | 247 + .../examples/components/built-in/checkbox.md | 233 + .../examples/components/built-in/form.md | 321 + .../examples/components/built-in/icon.md | 160 + .../examples/components/built-in/image.md | 373 + .../examples/components/built-in/input.md | 331 + .../examples/components/built-in/label.md | 262 + .../examples/components/built-in/map.md | 326 + .../examples/components/built-in/navigator.md | 204 + .../examples/components/built-in/picker.md | 290 + .../examples/components/built-in/progress.md | 209 + .../examples/components/built-in/radio.md | 172 + .../examples/components/built-in/rich-text.md | 247 + .../components/built-in/scroll-view.md | 337 + .../examples/components/built-in/slider.md | 262 + .../examples/components/built-in/swiper.md | 294 + .../examples/components/built-in/switch.md | 277 + .../examples/components/built-in/text.md | 151 + .../examples/components/built-in/textarea.md | 261 + .../examples/components/built-in/video.md | 291 + .../examples/components/built-in/view.md | 407 + .../examples/components/built-in/web-view.md | 196 + .../uniapp-project/examples/uni-ui/README.md | 98 + .../examples/uni-ui/uni-badge.vue | 160 + .../examples/uni-ui/uni-breadcrumb.vue | 96 + .../examples/uni-ui/uni-calendar.vue | 126 + .../examples/uni-ui/uni-card.vue | 216 + .../examples/uni-ui/uni-collapse.vue | 122 + .../examples/uni-ui/uni-combox.vue | 93 + .../examples/uni-ui/uni-countdown.vue | 109 + .../examples/uni-ui/uni-data-checkbox.vue | 100 + .../examples/uni-ui/uni-data-picker.vue | 105 + .../examples/uni-ui/uni-data-select.vue | 92 + .../examples/uni-ui/uni-dateformat.vue | 68 + .../examples/uni-ui/uni-datetime-picker.vue | 91 + .../examples/uni-ui/uni-drawer.vue | 153 + .../examples/uni-ui/uni-easyinput.vue | 93 + .../examples/uni-ui/uni-fab.vue | 105 + .../examples/uni-ui/uni-fav.vue | 105 + .../examples/uni-ui/uni-file-picker.vue | 106 + .../examples/uni-ui/uni-forms.vue | 342 + .../examples/uni-ui/uni-goods-nav.vue | 136 + .../examples/uni-ui/uni-grid.vue | 123 + .../examples/uni-ui/uni-group.vue | 78 + .../examples/uni-ui/uni-icons.vue | 135 + .../examples/uni-ui/uni-indexed-list.vue | 110 + .../examples/uni-ui/uni-link.vue | 80 + .../examples/uni-ui/uni-list.vue | 188 + .../examples/uni-ui/uni-load-more.vue | 75 + .../examples/uni-ui/uni-nav-bar.vue | 114 + .../examples/uni-ui/uni-notice-bar.vue | 88 + .../examples/uni-ui/uni-number-box.vue | 94 + .../examples/uni-ui/uni-pagination.vue | 81 + .../examples/uni-ui/uni-popup.vue | 245 + .../examples/uni-ui/uni-rate.vue | 105 + .../examples/uni-ui/uni-row.vue | 97 + .../examples/uni-ui/uni-search-bar.vue | 112 + .../examples/uni-ui/uni-section.vue | 77 + .../examples/uni-ui/uni-segmented-control.vue | 96 + .../examples/uni-ui/uni-steps.vue | 82 + .../examples/uni-ui/uni-swipe-action.vue | 122 + .../examples/uni-ui/uni-swiper-dot.vue | 112 + .../examples/uni-ui/uni-table.vue | 98 + .../examples/uni-ui/uni-tag.vue | 83 + .../examples/uni-ui/uni-title.vue | 81 + .../examples/uni-ui/uni-tooltip.vue | 77 + .../examples/uni-ui/uni-transition.vue | 103 + .../uniapp-project/references/api/README.md | 174 + .../uniapp-project/references/api/device.md | 63 + .../uniapp-project/references/api/file.md | 35 + .../uniapp-project/references/api/location.md | 59 + .../uniapp-project/references/api/media.md | 67 + .../references/api/navigation.md | 60 + .../uniapp-project/references/api/network.md | 276 + .../uniapp-project/references/api/other.md | 58 + .../uniapp-project/references/api/payment.md | 43 + .../uniapp-project/references/api/share.md | 25 + .../uniapp-project/references/api/storage.md | 65 + .../uniapp-project/references/api/ui.md | 75 + .../references/components/README.md | 174 + .../references/components/built-in/ad-draw.md | 32 + .../references/components/built-in/ad.md | 32 + .../references/components/built-in/audio.md | 112 + .../references/components/built-in/button.md | 240 + .../references/components/built-in/camera.md | 121 + .../references/components/built-in/canvas.md | 99 + .../components/built-in/checkbox.md | 198 + .../components/built-in/cover-image.md | 138 + .../components/built-in/cover-view.md | 34 + .../components/built-in/custom-tab-bar.md | 58 + .../references/components/built-in/editor.md | 252 + .../references/components/built-in/form.md | 238 + .../references/components/built-in/icon.md | 99 + .../references/components/built-in/image.md | 133 + .../references/components/built-in/input.md | 133 + .../references/components/built-in/label.md | 201 + .../components/built-in/live-player.md | 104 + .../components/built-in/live-pusher.md | 280 + .../references/components/built-in/map.md | 128 + .../components/built-in/match-media.md | 70 + .../components/built-in/movable-area.md | 34 + .../components/built-in/movable-view.md | 138 + .../components/built-in/navigation-bar.md | 131 + .../components/built-in/navigator.md | 141 + .../components/built-in/page-meta.md | 214 + .../components/built-in/picker-view.md | 154 + .../references/components/built-in/picker.md | 197 + .../components/built-in/progress.md | 147 + .../references/components/built-in/radio.md | 138 + .../components/built-in/rich-text.md | 117 + .../components/built-in/scroll-view.md | 228 + .../references/components/built-in/slider.md | 130 + .../references/components/built-in/swiper.md | 219 + .../references/components/built-in/switch.md | 121 + .../references/components/built-in/text.md | 121 + .../components/built-in/textarea.md | 230 + .../components/built-in/unicloud-db.md | 101 + .../references/components/built-in/video.md | 198 + .../references/components/built-in/view.md | 95 + .../components/built-in/web-view.md | 289 + .../references/components/uni-ui/uni-badge.md | 309 + .../components/uni-ui/uni-breadcrumb.md | 216 + .../components/uni-ui/uni-calendar.md | 137 + .../references/components/uni-ui/uni-card.md | 98 + .../components/uni-ui/uni-collapse.md | 134 + .../components/uni-ui/uni-combox.md | 151 + .../components/uni-ui/uni-countdown.md | 190 + .../components/uni-ui/uni-data-checkbox.md | 198 + .../components/uni-ui/uni-data-picker.md | 239 + .../components/uni-ui/uni-data-select.md | 175 + .../components/uni-ui/uni-dateformat.md | 146 + .../components/uni-ui/uni-datetime-picker.md | 469 + .../components/uni-ui/uni-drawer.md | 285 + .../components/uni-ui/uni-easyinput.md | 113 + .../references/components/uni-ui/uni-fab.md | 239 + .../references/components/uni-ui/uni-fav.md | 204 + .../components/uni-ui/uni-file-picker.md | 217 + .../references/components/uni-ui/uni-forms.md | 139 + .../components/uni-ui/uni-goods-nav.md | 296 + .../references/components/uni-ui/uni-grid.md | 383 + .../references/components/uni-ui/uni-group.md | 149 + .../references/components/uni-ui/uni-icons.md | 83 + .../components/uni-ui/uni-indexed-list.md | 116 + .../references/components/uni-ui/uni-link.md | 113 + .../references/components/uni-ui/uni-list.md | 92 + .../components/uni-ui/uni-load-more.md | 217 + .../components/uni-ui/uni-nav-bar.md | 90 + .../components/uni-ui/uni-notice-bar.md | 87 + .../components/uni-ui/uni-number-box.md | 159 + .../components/uni-ui/uni-pagination.md | 198 + .../references/components/uni-ui/uni-popup.md | 115 + .../references/components/uni-ui/uni-rate.md | 236 + .../references/components/uni-ui/uni-row.md | 161 + .../components/uni-ui/uni-search-bar.md | 195 + .../components/uni-ui/uni-section.md | 220 + .../uni-ui/uni-segmented-control.md | 359 + .../references/components/uni-ui/uni-steps.md | 174 + .../components/uni-ui/uni-swipe-action.md | 239 + .../components/uni-ui/uni-swiper-dot.md | 231 + .../references/components/uni-ui/uni-table.md | 195 + .../references/components/uni-ui/uni-tag.md | 331 + .../references/components/uni-ui/uni-title.md | 235 + .../components/uni-ui/uni-tooltip.md | 172 + .../components/uni-ui/uni-transition.md | 210 + .../scripts/generate-builtin-block-docs.py | 582 + .../scripts/generate-uniui-block-docs.py | 375 + .agents/skills/uview-pro-vue3/LICENSE.txt | 202 + .agents/skills/uview-pro-vue3/SKILL.md | 273 + .../uview-pro-vue3/api/component-api.md | 71 + .../skills/uview-pro-vue3/api/config-api.md | 80 + .../uview-pro-vue3/api/props-and-events.md | 95 + .../skills/uview-pro-vue3/api/tools-api.md | 69 + .../examples/components/button.md | 84 + .../examples/components/form.md | 106 + .../examples/components/input.md | 110 + .../examples/components/intro.md | 54 + .../uview-pro-vue3/examples/guide/config.md | 68 + .../uview-pro-vue3/examples/guide/i18n.md | 65 + .../examples/guide/installation.md | 80 + .../uview-pro-vue3/examples/guide/intro.md | 49 + .../examples/guide/quick-start.md | 88 + .../uview-pro-vue3/examples/guide/theme.md | 75 + .../uview-pro-vue3/examples/layout/intro.md | 77 + .../uview-pro-vue3/examples/tools/http.md | 101 + .../uview-pro-vue3/examples/tools/intro.md | 73 + .../templates/component-usage.md | 103 + .../uview-pro-vue3/templates/installation.md | 56 + .../uview-pro-vue3/templates/project-setup.md | 70 + .changeset/README.md | 8 + .changeset/config.json | 11 + .commitlintrc.cjs | 3 + .cursor/rules/api-http-patterns.mdc | 51 + .cursor/rules/development-workflow.mdc | 43 + .cursor/rules/project-overview.mdc | 36 + .cursor/rules/styling-css-patterns.mdc | 54 + .cursor/rules/uni-app-patterns.mdc | 63 + .cursor/rules/vue-typescript-patterns.mdc | 53 + .editorconfig | 13 + .gitignore | 51 + .husky/commit-msg | 1 + .husky/pre-commit | 1 + .npmrc | 9 + .vscode/extensions.json | 15 + .vscode/settings.json | 102 + .vscode/vue3.code-snippets | 80 + AGENTS.md | 54 + LICENSE | 21 + README.md | 122 + env/.env | 41 + env/.env.development | 9 + env/.env.production | 9 + env/.env.test | 9 + eslint.config.mjs | 60 + favicon.ico | Bin 0 -> 4286 bytes hermes/README.md | 35 + hermes/api.md | 67 + hermes/architecture.md | 64 + hermes/conventions.md | 47 + hermes/performance.md | 34 + hermes/platforms.md | 67 + hermes/release.md | 49 + hermes/sop-new-page.md | 48 + index.html | 26 + manifest.config.ts | 164 + openapi-ts-request.config.ts | 14 + package.json | 232 + pages.config.ts | 31 + pnpm-lock.yaml | 22311 ++++++++++++++++ scripts/bump-version.js | 154 + scripts/create-base-files.js | 55 + scripts/open-dev-tools.js | 107 + scripts/postupgrade.js | 95 + scripts/upload-weixin.js | 270 + scripts/vite-plugin-eruda.js | 37 + src/App.ku.vue | 40 + src/App.vue | 52 + src/api/foo-alova.ts | 17 + src/api/foo.ts | 43 + src/api/login.ts | 85 + src/api/types/login.ts | 102 + src/components/.gitkeep | 0 .../qiun-data-charts/config-echarts.js | 444 + .../qiun-data-charts/config-ucharts.js | 675 + .../qiun-data-charts/qiun-data-charts.vue | 1826 ++ src/components/qiun-data-charts/u-charts.js | 3 + src/components/qiun-error/qiun-error.vue | 48 + src/components/qiun-loading/loading1.vue | 153 + src/components/qiun-loading/loading2.vue | 183 + src/components/qiun-loading/loading3.vue | 190 + src/components/qiun-loading/loading4.vue | 250 + src/components/qiun-loading/loading5.vue | 259 + src/components/qiun-loading/qiun-loading.vue | 33 + .../qiun-title-bar/qiun-title-bar.vue | 47 + src/env.d.ts | 41 + src/hooks/useRequest.test.ts | 74 + src/hooks/useRequest.ts | 54 + src/hooks/useScroll.md | 116 + src/hooks/useScroll.ts | 74 + src/hooks/useUpload.ts | 171 + src/http/README.md | 59 + src/http/alova.ts | 119 + src/http/http.ts | 243 + src/http/interceptor.ts | 69 + src/http/tools/enum.ts | 89 + src/http/tools/queryString.ts | 29 + src/http/types.ts | 53 + src/http/vue-query.ts | 30 + src/layouts/default.vue | 3 + src/locale/README.md | 12 + src/locale/en.json | 11 + src/locale/index.ts | 81 + src/locale/zh-Hans.json | 11 + src/main.ts | 21 + src/pages-demo/ucharts/data.json | 706 + src/pages-demo/ucharts/index.vue | 100 + src/pages/auth/README.md | 20 + src/pages/auth/login.vue | 44 + src/pages/auth/register.vue | 34 + src/pages/index/index.vue | 33 + src/pages/tabbar/about/about.vue | 13 + src/pages/tabbar/category/category.vue | 13 + src/pages/tabbar/gallery/gallery.vue | 13 + src/pages/tabbar/home/home.vue | 14 + src/pages/tabbar/moments/moments.vue | 13 + src/router/README.md | 55 + src/router/config.ts | 30 + src/router/interceptor.ts | 145 + src/router/permission.ts | 11 + src/service/index.ts | 6 + src/service/info.ts | 14 + src/service/listAll.ts | 18 + src/service/types.ts | 29 + src/static/app/icons/1024x1024.png | Bin 0 -> 59336 bytes src/static/app/icons/120x120.png | Bin 0 -> 3231 bytes src/static/app/icons/144x144.png | Bin 0 -> 3791 bytes src/static/app/icons/152x152.png | Bin 0 -> 3981 bytes src/static/app/icons/167x167.png | Bin 0 -> 4479 bytes src/static/app/icons/180x180.png | Bin 0 -> 4844 bytes src/static/app/icons/192x192.png | Bin 0 -> 5319 bytes src/static/app/icons/20x20.png | Bin 0 -> 574 bytes src/static/app/icons/29x29.png | Bin 0 -> 780 bytes src/static/app/icons/40x40.png | Bin 0 -> 985 bytes src/static/app/icons/58x58.png | Bin 0 -> 1483 bytes src/static/app/icons/60x60.png | Bin 0 -> 1521 bytes src/static/app/icons/72x72.png | Bin 0 -> 1802 bytes src/static/app/icons/76x76.png | Bin 0 -> 1972 bytes src/static/app/icons/80x80.png | Bin 0 -> 2060 bytes src/static/app/icons/87x87.png | Bin 0 -> 2289 bytes src/static/app/icons/96x96.png | Bin 0 -> 2396 bytes src/static/images/avatar.jpg | Bin 0 -> 58805 bytes src/static/images/default-avatar.png | Bin 0 -> 560 bytes src/static/logo.svg | 33 + src/static/my-icons/copyright.svg | 1 + src/static/tabbar/select_category.png | Bin 0 -> 5898 bytes src/static/tabbar/select_category_active.png | Bin 0 -> 6287 bytes src/static/tabbar/select_gallery.png | Bin 0 -> 4003 bytes src/static/tabbar/select_gallery_active.png | Bin 0 -> 5371 bytes src/static/tabbar/select_home.png | Bin 0 -> 3851 bytes src/static/tabbar/select_home_active.png | Bin 0 -> 4897 bytes src/static/tabbar/select_links.png | Bin 0 -> 4975 bytes src/static/tabbar/select_links_active.png | Bin 0 -> 7174 bytes src/static/tabbar/select_mine.png | Bin 0 -> 4420 bytes src/static/tabbar/select_mine_active.png | Bin 0 -> 5264 bytes src/store/index.ts | 20 + src/store/token.ts | 323 + src/store/user.test.ts | 71 + src/store/user.ts | 61 + src/style/iconfont.css | 28 + src/style/index.scss | 36 + src/tabbar/README.md | 78 + src/tabbar/TabbarItem.test.ts | 69 + src/tabbar/TabbarItem.vue | 51 + src/tabbar/config.ts | 172 + src/tabbar/i18n.ts | 29 + src/tabbar/index.vue | 144 + src/tabbar/store.ts | 124 + src/tabbar/types.ts | 37 + src/test-setup.ts | 51 + src/typings.d.ts | 171 + src/typings.ts | 21 + src/uni.scss | 77 + src/uni_modules/.gitkeep | 0 src/utils/debounce.test.ts | 59 + src/utils/debounce.ts | 166 + src/utils/i18n.ts | 10 + src/utils/index.ts | 179 + src/utils/systemInfo.ts | 38 + src/utils/toLoginPage.ts | 44 + src/utils/updateManager.wx.ts | 29 + src/utils/uploadFile.ts | 325 + tsconfig.json | 58 + uno.config.ts | 127 + vite-plugins/README.md | 236 + vite-plugins/copy-native-resources.ts | 198 + vite-plugins/sync-manifest-plugins.ts | 68 + vite.config.ts | 215 + vitest.config.ts | 21 + wot-ui-resolver.ts | 27 + 693 files changed, 118430 insertions(+) create mode 100644 .agents/README.md create mode 100644 .agents/bak-skills/uniapp-ad/LICENSE.txt create mode 100644 .agents/bak-skills/uniapp-ad/SKILL.md create mode 100644 .agents/bak-skills/uniapp-ad/api/ad-api.md create mode 100644 .agents/bak-skills/uniapp-ad/examples/ad-types/banner.md create mode 100644 .agents/bak-skills/uniapp-ad/examples/ad-types/interstitial.md create mode 100644 .agents/bak-skills/uniapp-ad/examples/ad-types/native.md create mode 100644 .agents/bak-skills/uniapp-ad/examples/ad-types/rewarded-video.md create mode 100644 .agents/bak-skills/uniapp-ad/examples/guide/intro.md create mode 100644 .agents/bak-skills/uniapp-ad/examples/integration/config.md create mode 100644 .agents/bak-skills/uniapp-ad/examples/integration/events.md create mode 100644 .agents/bak-skills/uniapp-cloud/LICENSE.txt create mode 100644 .agents/bak-skills/uniapp-cloud/SKILL.md create mode 100644 .agents/bak-skills/uniapp-cloud/api/cloud-api.md create mode 100644 .agents/bak-skills/uniapp-cloud/examples/database/crud.md create mode 100644 .agents/bak-skills/uniapp-cloud/examples/database/indexes.md create mode 100644 .agents/bak-skills/uniapp-cloud/examples/database/permissions.md create mode 100644 .agents/bak-skills/uniapp-cloud/examples/database/query.md create mode 100644 .agents/bak-skills/uniapp-cloud/examples/datacom/intro.md create mode 100644 .agents/bak-skills/uniapp-cloud/examples/functions/call-function.md create mode 100644 .agents/bak-skills/uniapp-cloud/examples/functions/create-function.md create mode 100644 .agents/bak-skills/uniapp-cloud/examples/guide/cloud-space.md create mode 100644 .agents/bak-skills/uniapp-cloud/examples/guide/intro.md create mode 100644 .agents/bak-skills/uniapp-cloud/examples/guide/project-setup.md create mode 100644 .agents/bak-skills/uniapp-cloud/examples/security/rules.md create mode 100644 .agents/bak-skills/uniapp-cloud/examples/storage/delete.md create mode 100644 .agents/bak-skills/uniapp-cloud/examples/storage/download.md create mode 100644 .agents/bak-skills/uniapp-cloud/examples/storage/upload.md create mode 100644 .agents/bak-skills/uniapp-mini-guide/LICENSE.txt create mode 100644 .agents/bak-skills/uniapp-mini-guide/SKILL.md create mode 100644 .agents/bak-skills/uniapp-mini-guide/examples/api/overview.md create mode 100644 .agents/bak-skills/uniapp-mini-guide/examples/components/overview.md create mode 100644 .agents/bak-skills/uniapp-mini-guide/examples/guide/config.md create mode 100644 .agents/bak-skills/uniapp-mini-guide/examples/guide/intro.md create mode 100644 .agents/bak-skills/uniapp-native-app/LICENSE.txt create mode 100644 .agents/bak-skills/uniapp-native-app/SKILL.md create mode 100644 .agents/bak-skills/uniapp-native-app/examples/android/build.md create mode 100644 .agents/bak-skills/uniapp-native-app/examples/android/keystore.md create mode 100644 .agents/bak-skills/uniapp-native-app/examples/android/signing.md create mode 100644 .agents/bak-skills/uniapp-native-app/examples/guide/intro.md create mode 100644 .agents/bak-skills/uniapp-native-app/examples/guide/offline-packaging.md create mode 100644 .agents/bak-skills/uniapp-native-app/examples/ios/provisioning.md create mode 100644 .agents/bak-skills/uniapp-native-app/examples/ios/signing.md create mode 100644 .agents/bak-skills/uniapp-native-app/templates/build-config.md create mode 100644 .agents/bak-skills/uniapp-native-plugin/LICENSE.txt create mode 100644 .agents/bak-skills/uniapp-native-plugin/SKILL.md create mode 100644 .agents/bak-skills/uniapp-native-plugin/examples/android-plugin/native-api.md create mode 100644 .agents/bak-skills/uniapp-native-plugin/examples/android-plugin/project-setup.md create mode 100644 .agents/bak-skills/uniapp-native-plugin/examples/guide/bridge.md create mode 100644 .agents/bak-skills/uniapp-native-plugin/examples/guide/intro.md create mode 100644 .agents/bak-skills/uniapp-native-plugin/examples/guide/structure.md create mode 100644 .agents/bak-skills/uniapp-native-plugin/examples/ios-plugin/native-api.md create mode 100644 .agents/bak-skills/uniapp-native-plugin/examples/ios-plugin/project-setup.md create mode 100644 .agents/bak-skills/uniapp-native-plugin/templates/plugin-template.md create mode 100644 .agents/bak-skills/uniapp-plugin/LICENSE.txt create mode 100644 .agents/bak-skills/uniapp-plugin/SKILL.md create mode 100644 .agents/bak-skills/uniapp-plugin/examples/guide/intro.md create mode 100644 .agents/bak-skills/uniapp-plugin/examples/installation/hbuilderx.md create mode 100644 .agents/bak-skills/uniapp-plugin/examples/installation/marketplace.md create mode 100644 .agents/bak-skills/uniapp-plugin/examples/plugin-types/api.md create mode 100644 .agents/bak-skills/uniapp-plugin/examples/plugin-types/component.md create mode 100644 .agents/bak-skills/uniapp-plugin/examples/plugin-types/template.md create mode 100644 .agents/bak-skills/uniapp-plugin/templates/plugin-usage.md create mode 100644 .agents/bak-skills/uniapp-project-creator/SKILL.md create mode 100644 .agents/bak-skills/uniapp-project-creator/examples/guide/installation.md create mode 100644 .agents/bak-skills/uniapp-project-creator/examples/guide/project-types.md create mode 100644 .agents/bak-skills/uniapp-project-creator/examples/guide/quick-start.md create mode 100644 .agents/bak-skills/uniapp-project-creator/templates/cli-commands.md create mode 100644 .agents/bak-skills/uniapp-project-creator/templates/project-templates.md create mode 100644 .agents/bak-skills/uniapp-ucharts/LICENSE.txt create mode 100644 .agents/bak-skills/uniapp-ucharts/SKILL.md create mode 100644 .agents/bak-skills/uniapp-ucharts/api/config-api.md create mode 100644 .agents/bak-skills/uniapp-ucharts/api/integration-api.md create mode 100644 .agents/bak-skills/uniapp-ucharts/examples/advanced/build-optimization.md create mode 100644 .agents/bak-skills/uniapp-ucharts/examples/advanced/custom-theme.md create mode 100644 .agents/bak-skills/uniapp-ucharts/examples/advanced/multi-platform.md create mode 100644 .agents/bak-skills/uniapp-ucharts/examples/getting-started/easycom-config.md create mode 100644 .agents/bak-skills/uniapp-ucharts/examples/getting-started/installation.md create mode 100644 .agents/bak-skills/uniapp-ucharts/examples/getting-started/project-setup.md create mode 100644 .agents/bak-skills/uniapp-ucharts/examples/integration/manifest-config.md create mode 100644 .agents/bak-skills/uniapp-ucharts/examples/integration/navigation.md create mode 100644 .agents/bak-skills/uniapp-ucharts/examples/integration/pages-config.md create mode 100644 .agents/bak-skills/uniapp-ucharts/examples/integration/uni-api.md create mode 100644 .agents/bak-skills/uniapp-ucharts/examples/platform-specific/app.md create mode 100644 .agents/bak-skills/uniapp-ucharts/examples/platform-specific/h5.md create mode 100644 .agents/bak-skills/uniapp-ucharts/examples/platform-specific/miniprogram.md create mode 100644 .agents/bak-skills/uniapp-ucharts/examples/platform-specific/nvue.md create mode 100644 .agents/bak-skills/uniapp-ucharts/templates/basic-uniapp-project.md create mode 100644 .agents/bak-skills/uniapp-ucharts/templates/manifest-template.md create mode 100644 .agents/bak-skills/uniapp-ucharts/templates/pages-template.md create mode 100644 .agents/bak-skills/uniapp-uview/SKILL.md create mode 100644 .agents/bak-skills/uniapp-uview/api/config-api.md create mode 100644 .agents/bak-skills/uniapp-uview/api/integration-api.md create mode 100644 .agents/bak-skills/uniapp-uview/examples/advanced/build-optimization.md create mode 100644 .agents/bak-skills/uniapp-uview/examples/advanced/custom-theme.md create mode 100644 .agents/bak-skills/uniapp-uview/examples/advanced/multi-platform.md create mode 100644 .agents/bak-skills/uniapp-uview/examples/getting-started/easycom-config.md create mode 100644 .agents/bak-skills/uniapp-uview/examples/getting-started/installation.md create mode 100644 .agents/bak-skills/uniapp-uview/examples/getting-started/project-setup.md create mode 100644 .agents/bak-skills/uniapp-uview/examples/integration/manifest-config.md create mode 100644 .agents/bak-skills/uniapp-uview/examples/integration/navigation.md create mode 100644 .agents/bak-skills/uniapp-uview/examples/integration/pages-config.md create mode 100644 .agents/bak-skills/uniapp-uview/examples/integration/uni-api.md create mode 100644 .agents/bak-skills/uniapp-uview/examples/platform-specific/app.md create mode 100644 .agents/bak-skills/uniapp-uview/examples/platform-specific/h5.md create mode 100644 .agents/bak-skills/uniapp-uview/examples/platform-specific/miniprogram.md create mode 100644 .agents/bak-skills/uniapp-uview/examples/platform-specific/nvue.md create mode 100644 .agents/bak-skills/uniapp-uview/templates/basic-uniapp-project.md create mode 100644 .agents/bak-skills/uniapp-uview/templates/manifest-template.md create mode 100644 .agents/bak-skills/uniapp-uview/templates/pages-template.md create mode 100644 .agents/bak-skills/uniappx-project-creator/SKILL.md create mode 100644 .agents/bak-skills/uniappx-project-creator/examples/guide/installation.md create mode 100644 .agents/bak-skills/uniappx-project-creator/examples/guide/project-types.md create mode 100644 .agents/bak-skills/uniappx-project-creator/examples/guide/quick-start.md create mode 100644 .agents/bak-skills/uniappx-project-creator/templates/cli-commands.md create mode 100644 .agents/bak-skills/uniappx-project-creator/templates/project-templates.md create mode 100644 .agents/bak-skills/uniappx-project/LICENSE.txt create mode 100644 .agents/bak-skills/uniappx-project/SKILL.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/device/get-battery-info.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/device/get-network-type.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/device/get-screen-brightness.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/device/get-system-info.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/device/set-screen-brightness.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/file/get-file-info.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/file/get-saved-file-list.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/file/save-file.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/location/choose-location.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/location/get-location.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/location/open-location.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/media/choose-image.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/media/choose-media.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/media/choose-video.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/media/get-image-info.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/media/preview-image.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/media/save-image-to-photos-album.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/navigation/navigate-back.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/navigation/navigate-to.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/navigation/re-launch.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/navigation/redirect-to.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/navigation/switch-tab.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/network/download-file.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/network/request.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/network/upload-file.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/storage/clear-storage.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/storage/get-storage-info.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/storage/get-storage-sync.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/storage/get-storage.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/storage/remove-storage.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/storage/set-storage-sync.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/storage/set-storage.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/ui/hide-loading.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/ui/hide-navigation-bar-loading.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/ui/hide-tab-bar-red-dot.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/ui/hide-toast.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/ui/remove-tab-bar-badge.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/ui/set-navigation-bar-color.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/ui/set-navigation-bar-title.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/ui/set-tab-bar-badge.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/ui/set-tab-bar-style.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/ui/show-action-sheet.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/ui/show-loading.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/ui/show-modal.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/ui/show-navigation-bar-loading.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/ui/show-tab-bar-red-dot.md create mode 100644 .agents/bak-skills/uniappx-project/examples/api/ui/show-toast.md create mode 100644 .agents/bak-skills/uniappx-project/examples/components/built-in/audio.md create mode 100644 .agents/bak-skills/uniappx-project/examples/components/built-in/button.md create mode 100644 .agents/bak-skills/uniappx-project/examples/components/built-in/camera.md create mode 100644 .agents/bak-skills/uniappx-project/examples/components/built-in/canvas.md create mode 100644 .agents/bak-skills/uniappx-project/examples/components/built-in/checkbox.md create mode 100644 .agents/bak-skills/uniappx-project/examples/components/built-in/form.md create mode 100644 .agents/bak-skills/uniappx-project/examples/components/built-in/icon.md create mode 100644 .agents/bak-skills/uniappx-project/examples/components/built-in/image.md create mode 100644 .agents/bak-skills/uniappx-project/examples/components/built-in/input.md create mode 100644 .agents/bak-skills/uniappx-project/examples/components/built-in/label.md create mode 100644 .agents/bak-skills/uniappx-project/examples/components/built-in/map.md create mode 100644 .agents/bak-skills/uniappx-project/examples/components/built-in/navigator.md create mode 100644 .agents/bak-skills/uniappx-project/examples/components/built-in/picker.md create mode 100644 .agents/bak-skills/uniappx-project/examples/components/built-in/progress.md create mode 100644 .agents/bak-skills/uniappx-project/examples/components/built-in/radio.md create mode 100644 .agents/bak-skills/uniappx-project/examples/components/built-in/rich-text.md create mode 100644 .agents/bak-skills/uniappx-project/examples/components/built-in/scroll-view.md create mode 100644 .agents/bak-skills/uniappx-project/examples/components/built-in/slider.md create mode 100644 .agents/bak-skills/uniappx-project/examples/components/built-in/swiper.md create mode 100644 .agents/bak-skills/uniappx-project/examples/components/built-in/switch.md create mode 100644 .agents/bak-skills/uniappx-project/examples/components/built-in/text.md create mode 100644 .agents/bak-skills/uniappx-project/examples/components/built-in/textarea.md create mode 100644 .agents/bak-skills/uniappx-project/examples/components/built-in/video.md create mode 100644 .agents/bak-skills/uniappx-project/examples/components/built-in/view.md create mode 100644 .agents/bak-skills/uniappx-project/examples/components/built-in/web-view.md create mode 100644 .agents/bak-skills/uniappx-project/references/api/README.md create mode 100644 .agents/bak-skills/uniappx-project/references/api/device.md create mode 100644 .agents/bak-skills/uniappx-project/references/api/file.md create mode 100644 .agents/bak-skills/uniappx-project/references/api/location.md create mode 100644 .agents/bak-skills/uniappx-project/references/api/media.md create mode 100644 .agents/bak-skills/uniappx-project/references/api/navigation.md create mode 100644 .agents/bak-skills/uniappx-project/references/api/network.md create mode 100644 .agents/bak-skills/uniappx-project/references/api/other.md create mode 100644 .agents/bak-skills/uniappx-project/references/api/payment.md create mode 100644 .agents/bak-skills/uniappx-project/references/api/share.md create mode 100644 .agents/bak-skills/uniappx-project/references/api/storage.md create mode 100644 .agents/bak-skills/uniappx-project/references/api/ui.md create mode 100644 .agents/bak-skills/uniappx-project/references/components/README.md create mode 100644 .agents/bak-skills/uniappx-project/references/components/built-in/ad-draw.md create mode 100644 .agents/bak-skills/uniappx-project/references/components/built-in/ad.md create mode 100644 .agents/bak-skills/uniappx-project/references/components/built-in/audio.md create mode 100644 .agents/bak-skills/uniappx-project/references/components/built-in/button.md create mode 100644 .agents/bak-skills/uniappx-project/references/components/built-in/camera.md create mode 100644 .agents/bak-skills/uniappx-project/references/components/built-in/canvas.md create mode 100644 .agents/bak-skills/uniappx-project/references/components/built-in/checkbox.md create mode 100644 .agents/bak-skills/uniappx-project/references/components/built-in/cover-image.md create mode 100644 .agents/bak-skills/uniappx-project/references/components/built-in/cover-view.md create mode 100644 .agents/bak-skills/uniappx-project/references/components/built-in/custom-tab-bar.md create mode 100644 .agents/bak-skills/uniappx-project/references/components/built-in/editor.md create mode 100644 .agents/bak-skills/uniappx-project/references/components/built-in/form.md create mode 100644 .agents/bak-skills/uniappx-project/references/components/built-in/icon.md create mode 100644 .agents/bak-skills/uniappx-project/references/components/built-in/image.md create mode 100644 .agents/bak-skills/uniappx-project/references/components/built-in/input.md create mode 100644 .agents/bak-skills/uniappx-project/references/components/built-in/label.md create mode 100644 .agents/bak-skills/uniappx-project/references/components/built-in/live-player.md create mode 100644 .agents/bak-skills/uniappx-project/references/components/built-in/live-pusher.md create mode 100644 .agents/bak-skills/uniappx-project/references/components/built-in/map.md create mode 100644 .agents/bak-skills/uniappx-project/references/components/built-in/match-media.md create mode 100644 .agents/bak-skills/uniappx-project/references/components/built-in/movable-area.md create mode 100644 .agents/bak-skills/uniappx-project/references/components/built-in/movable-view.md create mode 100644 .agents/bak-skills/uniappx-project/references/components/built-in/navigation-bar.md create mode 100644 .agents/bak-skills/uniappx-project/references/components/built-in/navigator.md create mode 100644 .agents/bak-skills/uniappx-project/references/components/built-in/page-meta.md create mode 100644 .agents/bak-skills/uniappx-project/references/components/built-in/picker-view.md create mode 100644 .agents/bak-skills/uniappx-project/references/components/built-in/picker.md create mode 100644 .agents/bak-skills/uniappx-project/references/components/built-in/progress.md create mode 100644 .agents/bak-skills/uniappx-project/references/components/built-in/radio.md create mode 100644 .agents/bak-skills/uniappx-project/references/components/built-in/rich-text.md create mode 100644 .agents/bak-skills/uniappx-project/references/components/built-in/scroll-view.md create mode 100644 .agents/bak-skills/uniappx-project/references/components/built-in/slider.md create mode 100644 .agents/bak-skills/uniappx-project/references/components/built-in/swiper.md create mode 100644 .agents/bak-skills/uniappx-project/references/components/built-in/switch.md create mode 100644 .agents/bak-skills/uniappx-project/references/components/built-in/text.md create mode 100644 .agents/bak-skills/uniappx-project/references/components/built-in/textarea.md create mode 100644 .agents/bak-skills/uniappx-project/references/components/built-in/unicloud-db.md create mode 100644 .agents/bak-skills/uniappx-project/references/components/built-in/video.md create mode 100644 .agents/bak-skills/uniappx-project/references/components/built-in/view.md create mode 100644 .agents/bak-skills/uniappx-project/references/components/built-in/web-view.md create mode 100644 .agents/bak-skills/uniappx-uview-pro/LICENSE.txt create mode 100644 .agents/bak-skills/uniappx-uview-pro/SKILL.md create mode 100644 .agents/bak-skills/uniappx-uview-pro/api/config-api.md create mode 100644 .agents/bak-skills/uniappx-uview-pro/api/integration-api.md create mode 100644 .agents/bak-skills/uniappx-uview-pro/examples/advanced/build-optimization.md create mode 100644 .agents/bak-skills/uniappx-uview-pro/examples/advanced/custom-theme.md create mode 100644 .agents/bak-skills/uniappx-uview-pro/examples/advanced/multi-platform.md create mode 100644 .agents/bak-skills/uniappx-uview-pro/examples/getting-started/easycom-config.md create mode 100644 .agents/bak-skills/uniappx-uview-pro/examples/getting-started/installation.md create mode 100644 .agents/bak-skills/uniappx-uview-pro/examples/getting-started/project-setup.md create mode 100644 .agents/bak-skills/uniappx-uview-pro/examples/integration/manifest-config.md create mode 100644 .agents/bak-skills/uniappx-uview-pro/examples/integration/navigation.md create mode 100644 .agents/bak-skills/uniappx-uview-pro/examples/integration/pages-config.md create mode 100644 .agents/bak-skills/uniappx-uview-pro/examples/integration/uniappx-api.md create mode 100644 .agents/bak-skills/uniappx-uview-pro/examples/platform-specific/app.md create mode 100644 .agents/bak-skills/uniappx-uview-pro/examples/platform-specific/h5.md create mode 100644 .agents/bak-skills/uniappx-uview-pro/examples/platform-specific/miniprogram.md create mode 100644 .agents/bak-skills/uniappx-uview-pro/examples/platform-specific/nvue.md create mode 100644 .agents/bak-skills/uniappx-uview-pro/templates/basic-uniappx-project.md create mode 100644 .agents/bak-skills/uniappx-uview-pro/templates/manifest-template.md create mode 100644 .agents/bak-skills/uniappx-uview-pro/templates/pages-template.md create mode 100644 .agents/skills/README.md create mode 100644 .agents/skills/uni-app/GENERATION.md create mode 100644 .agents/skills/uni-app/SKILL.md create mode 100644 .agents/skills/uni-app/references/config-manifest.md create mode 100644 .agents/skills/uni-app/references/config-pages.md create mode 100644 .agents/skills/uni-app/references/core-form-components.md create mode 100644 .agents/skills/uni-app/references/core-framework.md create mode 100644 .agents/skills/uni-app/references/core-view-components.md create mode 100644 .agents/skills/uni-app/references/feature-file-operations.md create mode 100644 .agents/skills/uni-app/references/feature-lifecycle.md create mode 100644 .agents/skills/uni-app/references/feature-location.md create mode 100644 .agents/skills/uni-app/references/feature-media-components.md create mode 100644 .agents/skills/uni-app/references/feature-navigation.md create mode 100644 .agents/skills/uni-app/references/feature-network.md create mode 100644 .agents/skills/uni-app/references/feature-storage.md create mode 100644 .agents/skills/uni-app/references/feature-system-info.md create mode 100644 .agents/skills/uni-app/references/feature-ui-feedback.md create mode 100644 .agents/skills/uniapp-project/CHECKLIST.md create mode 100644 .agents/skills/uniapp-project/LICENSE.txt create mode 100644 .agents/skills/uniapp-project/SKILL.md create mode 100644 .agents/skills/uniapp-project/UPDATE_PLAN.md create mode 100644 .agents/skills/uniapp-project/examples/api/device/get-battery-info.md create mode 100644 .agents/skills/uniapp-project/examples/api/device/get-network-type.md create mode 100644 .agents/skills/uniapp-project/examples/api/device/get-screen-brightness.md create mode 100644 .agents/skills/uniapp-project/examples/api/device/get-system-info.md create mode 100644 .agents/skills/uniapp-project/examples/api/device/set-screen-brightness.md create mode 100644 .agents/skills/uniapp-project/examples/api/file/get-file-info.md create mode 100644 .agents/skills/uniapp-project/examples/api/file/get-saved-file-list.md create mode 100644 .agents/skills/uniapp-project/examples/api/file/save-file.md create mode 100644 .agents/skills/uniapp-project/examples/api/location/choose-location.md create mode 100644 .agents/skills/uniapp-project/examples/api/location/get-location.md create mode 100644 .agents/skills/uniapp-project/examples/api/location/open-location.md create mode 100644 .agents/skills/uniapp-project/examples/api/media/choose-image.md create mode 100644 .agents/skills/uniapp-project/examples/api/media/choose-media.md create mode 100644 .agents/skills/uniapp-project/examples/api/media/choose-video.md create mode 100644 .agents/skills/uniapp-project/examples/api/media/get-image-info.md create mode 100644 .agents/skills/uniapp-project/examples/api/media/preview-image.md create mode 100644 .agents/skills/uniapp-project/examples/api/media/save-image-to-photos-album.md create mode 100644 .agents/skills/uniapp-project/examples/api/navigation/navigate-back.md create mode 100644 .agents/skills/uniapp-project/examples/api/navigation/navigate-to.md create mode 100644 .agents/skills/uniapp-project/examples/api/navigation/re-launch.md create mode 100644 .agents/skills/uniapp-project/examples/api/navigation/redirect-to.md create mode 100644 .agents/skills/uniapp-project/examples/api/navigation/switch-tab.md create mode 100644 .agents/skills/uniapp-project/examples/api/network/download-file.md create mode 100644 .agents/skills/uniapp-project/examples/api/network/request.md create mode 100644 .agents/skills/uniapp-project/examples/api/network/upload-file.md create mode 100644 .agents/skills/uniapp-project/examples/api/storage/clear-storage.md create mode 100644 .agents/skills/uniapp-project/examples/api/storage/get-storage-info.md create mode 100644 .agents/skills/uniapp-project/examples/api/storage/get-storage-sync.md create mode 100644 .agents/skills/uniapp-project/examples/api/storage/get-storage.md create mode 100644 .agents/skills/uniapp-project/examples/api/storage/remove-storage.md create mode 100644 .agents/skills/uniapp-project/examples/api/storage/set-storage-sync.md create mode 100644 .agents/skills/uniapp-project/examples/api/storage/set-storage.md create mode 100644 .agents/skills/uniapp-project/examples/api/ui/hide-loading.md create mode 100644 .agents/skills/uniapp-project/examples/api/ui/hide-navigation-bar-loading.md create mode 100644 .agents/skills/uniapp-project/examples/api/ui/hide-tab-bar-red-dot.md create mode 100644 .agents/skills/uniapp-project/examples/api/ui/hide-toast.md create mode 100644 .agents/skills/uniapp-project/examples/api/ui/remove-tab-bar-badge.md create mode 100644 .agents/skills/uniapp-project/examples/api/ui/set-navigation-bar-color.md create mode 100644 .agents/skills/uniapp-project/examples/api/ui/set-navigation-bar-title.md create mode 100644 .agents/skills/uniapp-project/examples/api/ui/set-tab-bar-badge.md create mode 100644 .agents/skills/uniapp-project/examples/api/ui/set-tab-bar-style.md create mode 100644 .agents/skills/uniapp-project/examples/api/ui/show-action-sheet.md create mode 100644 .agents/skills/uniapp-project/examples/api/ui/show-loading.md create mode 100644 .agents/skills/uniapp-project/examples/api/ui/show-modal.md create mode 100644 .agents/skills/uniapp-project/examples/api/ui/show-navigation-bar-loading.md create mode 100644 .agents/skills/uniapp-project/examples/api/ui/show-tab-bar-red-dot.md create mode 100644 .agents/skills/uniapp-project/examples/api/ui/show-toast.md create mode 100644 .agents/skills/uniapp-project/examples/components/built-in/audio.md create mode 100644 .agents/skills/uniapp-project/examples/components/built-in/button.md create mode 100644 .agents/skills/uniapp-project/examples/components/built-in/camera.md create mode 100644 .agents/skills/uniapp-project/examples/components/built-in/canvas.md create mode 100644 .agents/skills/uniapp-project/examples/components/built-in/checkbox.md create mode 100644 .agents/skills/uniapp-project/examples/components/built-in/form.md create mode 100644 .agents/skills/uniapp-project/examples/components/built-in/icon.md create mode 100644 .agents/skills/uniapp-project/examples/components/built-in/image.md create mode 100644 .agents/skills/uniapp-project/examples/components/built-in/input.md create mode 100644 .agents/skills/uniapp-project/examples/components/built-in/label.md create mode 100644 .agents/skills/uniapp-project/examples/components/built-in/map.md create mode 100644 .agents/skills/uniapp-project/examples/components/built-in/navigator.md create mode 100644 .agents/skills/uniapp-project/examples/components/built-in/picker.md create mode 100644 .agents/skills/uniapp-project/examples/components/built-in/progress.md create mode 100644 .agents/skills/uniapp-project/examples/components/built-in/radio.md create mode 100644 .agents/skills/uniapp-project/examples/components/built-in/rich-text.md create mode 100644 .agents/skills/uniapp-project/examples/components/built-in/scroll-view.md create mode 100644 .agents/skills/uniapp-project/examples/components/built-in/slider.md create mode 100644 .agents/skills/uniapp-project/examples/components/built-in/swiper.md create mode 100644 .agents/skills/uniapp-project/examples/components/built-in/switch.md create mode 100644 .agents/skills/uniapp-project/examples/components/built-in/text.md create mode 100644 .agents/skills/uniapp-project/examples/components/built-in/textarea.md create mode 100644 .agents/skills/uniapp-project/examples/components/built-in/video.md create mode 100644 .agents/skills/uniapp-project/examples/components/built-in/view.md create mode 100644 .agents/skills/uniapp-project/examples/components/built-in/web-view.md create mode 100644 .agents/skills/uniapp-project/examples/uni-ui/README.md create mode 100644 .agents/skills/uniapp-project/examples/uni-ui/uni-badge.vue create mode 100644 .agents/skills/uniapp-project/examples/uni-ui/uni-breadcrumb.vue create mode 100644 .agents/skills/uniapp-project/examples/uni-ui/uni-calendar.vue create mode 100644 .agents/skills/uniapp-project/examples/uni-ui/uni-card.vue create mode 100644 .agents/skills/uniapp-project/examples/uni-ui/uni-collapse.vue create mode 100644 .agents/skills/uniapp-project/examples/uni-ui/uni-combox.vue create mode 100644 .agents/skills/uniapp-project/examples/uni-ui/uni-countdown.vue create mode 100644 .agents/skills/uniapp-project/examples/uni-ui/uni-data-checkbox.vue create mode 100644 .agents/skills/uniapp-project/examples/uni-ui/uni-data-picker.vue create mode 100644 .agents/skills/uniapp-project/examples/uni-ui/uni-data-select.vue create mode 100644 .agents/skills/uniapp-project/examples/uni-ui/uni-dateformat.vue create mode 100644 .agents/skills/uniapp-project/examples/uni-ui/uni-datetime-picker.vue create mode 100644 .agents/skills/uniapp-project/examples/uni-ui/uni-drawer.vue create mode 100644 .agents/skills/uniapp-project/examples/uni-ui/uni-easyinput.vue create mode 100644 .agents/skills/uniapp-project/examples/uni-ui/uni-fab.vue create mode 100644 .agents/skills/uniapp-project/examples/uni-ui/uni-fav.vue create mode 100644 .agents/skills/uniapp-project/examples/uni-ui/uni-file-picker.vue create mode 100644 .agents/skills/uniapp-project/examples/uni-ui/uni-forms.vue create mode 100644 .agents/skills/uniapp-project/examples/uni-ui/uni-goods-nav.vue create mode 100644 .agents/skills/uniapp-project/examples/uni-ui/uni-grid.vue create mode 100644 .agents/skills/uniapp-project/examples/uni-ui/uni-group.vue create mode 100644 .agents/skills/uniapp-project/examples/uni-ui/uni-icons.vue create mode 100644 .agents/skills/uniapp-project/examples/uni-ui/uni-indexed-list.vue create mode 100644 .agents/skills/uniapp-project/examples/uni-ui/uni-link.vue create mode 100644 .agents/skills/uniapp-project/examples/uni-ui/uni-list.vue create mode 100644 .agents/skills/uniapp-project/examples/uni-ui/uni-load-more.vue create mode 100644 .agents/skills/uniapp-project/examples/uni-ui/uni-nav-bar.vue create mode 100644 .agents/skills/uniapp-project/examples/uni-ui/uni-notice-bar.vue create mode 100644 .agents/skills/uniapp-project/examples/uni-ui/uni-number-box.vue create mode 100644 .agents/skills/uniapp-project/examples/uni-ui/uni-pagination.vue create mode 100644 .agents/skills/uniapp-project/examples/uni-ui/uni-popup.vue create mode 100644 .agents/skills/uniapp-project/examples/uni-ui/uni-rate.vue create mode 100644 .agents/skills/uniapp-project/examples/uni-ui/uni-row.vue create mode 100644 .agents/skills/uniapp-project/examples/uni-ui/uni-search-bar.vue create mode 100644 .agents/skills/uniapp-project/examples/uni-ui/uni-section.vue create mode 100644 .agents/skills/uniapp-project/examples/uni-ui/uni-segmented-control.vue create mode 100644 .agents/skills/uniapp-project/examples/uni-ui/uni-steps.vue create mode 100644 .agents/skills/uniapp-project/examples/uni-ui/uni-swipe-action.vue create mode 100644 .agents/skills/uniapp-project/examples/uni-ui/uni-swiper-dot.vue create mode 100644 .agents/skills/uniapp-project/examples/uni-ui/uni-table.vue create mode 100644 .agents/skills/uniapp-project/examples/uni-ui/uni-tag.vue create mode 100644 .agents/skills/uniapp-project/examples/uni-ui/uni-title.vue create mode 100644 .agents/skills/uniapp-project/examples/uni-ui/uni-tooltip.vue create mode 100644 .agents/skills/uniapp-project/examples/uni-ui/uni-transition.vue create mode 100644 .agents/skills/uniapp-project/references/api/README.md create mode 100644 .agents/skills/uniapp-project/references/api/device.md create mode 100644 .agents/skills/uniapp-project/references/api/file.md create mode 100644 .agents/skills/uniapp-project/references/api/location.md create mode 100644 .agents/skills/uniapp-project/references/api/media.md create mode 100644 .agents/skills/uniapp-project/references/api/navigation.md create mode 100644 .agents/skills/uniapp-project/references/api/network.md create mode 100644 .agents/skills/uniapp-project/references/api/other.md create mode 100644 .agents/skills/uniapp-project/references/api/payment.md create mode 100644 .agents/skills/uniapp-project/references/api/share.md create mode 100644 .agents/skills/uniapp-project/references/api/storage.md create mode 100644 .agents/skills/uniapp-project/references/api/ui.md create mode 100644 .agents/skills/uniapp-project/references/components/README.md create mode 100644 .agents/skills/uniapp-project/references/components/built-in/ad-draw.md create mode 100644 .agents/skills/uniapp-project/references/components/built-in/ad.md create mode 100644 .agents/skills/uniapp-project/references/components/built-in/audio.md create mode 100644 .agents/skills/uniapp-project/references/components/built-in/button.md create mode 100644 .agents/skills/uniapp-project/references/components/built-in/camera.md create mode 100644 .agents/skills/uniapp-project/references/components/built-in/canvas.md create mode 100644 .agents/skills/uniapp-project/references/components/built-in/checkbox.md create mode 100644 .agents/skills/uniapp-project/references/components/built-in/cover-image.md create mode 100644 .agents/skills/uniapp-project/references/components/built-in/cover-view.md create mode 100644 .agents/skills/uniapp-project/references/components/built-in/custom-tab-bar.md create mode 100644 .agents/skills/uniapp-project/references/components/built-in/editor.md create mode 100644 .agents/skills/uniapp-project/references/components/built-in/form.md create mode 100644 .agents/skills/uniapp-project/references/components/built-in/icon.md create mode 100644 .agents/skills/uniapp-project/references/components/built-in/image.md create mode 100644 .agents/skills/uniapp-project/references/components/built-in/input.md create mode 100644 .agents/skills/uniapp-project/references/components/built-in/label.md create mode 100644 .agents/skills/uniapp-project/references/components/built-in/live-player.md create mode 100644 .agents/skills/uniapp-project/references/components/built-in/live-pusher.md create mode 100644 .agents/skills/uniapp-project/references/components/built-in/map.md create mode 100644 .agents/skills/uniapp-project/references/components/built-in/match-media.md create mode 100644 .agents/skills/uniapp-project/references/components/built-in/movable-area.md create mode 100644 .agents/skills/uniapp-project/references/components/built-in/movable-view.md create mode 100644 .agents/skills/uniapp-project/references/components/built-in/navigation-bar.md create mode 100644 .agents/skills/uniapp-project/references/components/built-in/navigator.md create mode 100644 .agents/skills/uniapp-project/references/components/built-in/page-meta.md create mode 100644 .agents/skills/uniapp-project/references/components/built-in/picker-view.md create mode 100644 .agents/skills/uniapp-project/references/components/built-in/picker.md create mode 100644 .agents/skills/uniapp-project/references/components/built-in/progress.md create mode 100644 .agents/skills/uniapp-project/references/components/built-in/radio.md create mode 100644 .agents/skills/uniapp-project/references/components/built-in/rich-text.md create mode 100644 .agents/skills/uniapp-project/references/components/built-in/scroll-view.md create mode 100644 .agents/skills/uniapp-project/references/components/built-in/slider.md create mode 100644 .agents/skills/uniapp-project/references/components/built-in/swiper.md create mode 100644 .agents/skills/uniapp-project/references/components/built-in/switch.md create mode 100644 .agents/skills/uniapp-project/references/components/built-in/text.md create mode 100644 .agents/skills/uniapp-project/references/components/built-in/textarea.md create mode 100644 .agents/skills/uniapp-project/references/components/built-in/unicloud-db.md create mode 100644 .agents/skills/uniapp-project/references/components/built-in/video.md create mode 100644 .agents/skills/uniapp-project/references/components/built-in/view.md create mode 100644 .agents/skills/uniapp-project/references/components/built-in/web-view.md create mode 100644 .agents/skills/uniapp-project/references/components/uni-ui/uni-badge.md create mode 100644 .agents/skills/uniapp-project/references/components/uni-ui/uni-breadcrumb.md create mode 100644 .agents/skills/uniapp-project/references/components/uni-ui/uni-calendar.md create mode 100644 .agents/skills/uniapp-project/references/components/uni-ui/uni-card.md create mode 100644 .agents/skills/uniapp-project/references/components/uni-ui/uni-collapse.md create mode 100644 .agents/skills/uniapp-project/references/components/uni-ui/uni-combox.md create mode 100644 .agents/skills/uniapp-project/references/components/uni-ui/uni-countdown.md create mode 100644 .agents/skills/uniapp-project/references/components/uni-ui/uni-data-checkbox.md create mode 100644 .agents/skills/uniapp-project/references/components/uni-ui/uni-data-picker.md create mode 100644 .agents/skills/uniapp-project/references/components/uni-ui/uni-data-select.md create mode 100644 .agents/skills/uniapp-project/references/components/uni-ui/uni-dateformat.md create mode 100644 .agents/skills/uniapp-project/references/components/uni-ui/uni-datetime-picker.md create mode 100644 .agents/skills/uniapp-project/references/components/uni-ui/uni-drawer.md create mode 100644 .agents/skills/uniapp-project/references/components/uni-ui/uni-easyinput.md create mode 100644 .agents/skills/uniapp-project/references/components/uni-ui/uni-fab.md create mode 100644 .agents/skills/uniapp-project/references/components/uni-ui/uni-fav.md create mode 100644 .agents/skills/uniapp-project/references/components/uni-ui/uni-file-picker.md create mode 100644 .agents/skills/uniapp-project/references/components/uni-ui/uni-forms.md create mode 100644 .agents/skills/uniapp-project/references/components/uni-ui/uni-goods-nav.md create mode 100644 .agents/skills/uniapp-project/references/components/uni-ui/uni-grid.md create mode 100644 .agents/skills/uniapp-project/references/components/uni-ui/uni-group.md create mode 100644 .agents/skills/uniapp-project/references/components/uni-ui/uni-icons.md create mode 100644 .agents/skills/uniapp-project/references/components/uni-ui/uni-indexed-list.md create mode 100644 .agents/skills/uniapp-project/references/components/uni-ui/uni-link.md create mode 100644 .agents/skills/uniapp-project/references/components/uni-ui/uni-list.md create mode 100644 .agents/skills/uniapp-project/references/components/uni-ui/uni-load-more.md create mode 100644 .agents/skills/uniapp-project/references/components/uni-ui/uni-nav-bar.md create mode 100644 .agents/skills/uniapp-project/references/components/uni-ui/uni-notice-bar.md create mode 100644 .agents/skills/uniapp-project/references/components/uni-ui/uni-number-box.md create mode 100644 .agents/skills/uniapp-project/references/components/uni-ui/uni-pagination.md create mode 100644 .agents/skills/uniapp-project/references/components/uni-ui/uni-popup.md create mode 100644 .agents/skills/uniapp-project/references/components/uni-ui/uni-rate.md create mode 100644 .agents/skills/uniapp-project/references/components/uni-ui/uni-row.md create mode 100644 .agents/skills/uniapp-project/references/components/uni-ui/uni-search-bar.md create mode 100644 .agents/skills/uniapp-project/references/components/uni-ui/uni-section.md create mode 100644 .agents/skills/uniapp-project/references/components/uni-ui/uni-segmented-control.md create mode 100644 .agents/skills/uniapp-project/references/components/uni-ui/uni-steps.md create mode 100644 .agents/skills/uniapp-project/references/components/uni-ui/uni-swipe-action.md create mode 100644 .agents/skills/uniapp-project/references/components/uni-ui/uni-swiper-dot.md create mode 100644 .agents/skills/uniapp-project/references/components/uni-ui/uni-table.md create mode 100644 .agents/skills/uniapp-project/references/components/uni-ui/uni-tag.md create mode 100644 .agents/skills/uniapp-project/references/components/uni-ui/uni-title.md create mode 100644 .agents/skills/uniapp-project/references/components/uni-ui/uni-tooltip.md create mode 100644 .agents/skills/uniapp-project/references/components/uni-ui/uni-transition.md create mode 100644 .agents/skills/uniapp-project/scripts/generate-builtin-block-docs.py create mode 100644 .agents/skills/uniapp-project/scripts/generate-uniui-block-docs.py create mode 100644 .agents/skills/uview-pro-vue3/LICENSE.txt create mode 100644 .agents/skills/uview-pro-vue3/SKILL.md create mode 100644 .agents/skills/uview-pro-vue3/api/component-api.md create mode 100644 .agents/skills/uview-pro-vue3/api/config-api.md create mode 100644 .agents/skills/uview-pro-vue3/api/props-and-events.md create mode 100644 .agents/skills/uview-pro-vue3/api/tools-api.md create mode 100644 .agents/skills/uview-pro-vue3/examples/components/button.md create mode 100644 .agents/skills/uview-pro-vue3/examples/components/form.md create mode 100644 .agents/skills/uview-pro-vue3/examples/components/input.md create mode 100644 .agents/skills/uview-pro-vue3/examples/components/intro.md create mode 100644 .agents/skills/uview-pro-vue3/examples/guide/config.md create mode 100644 .agents/skills/uview-pro-vue3/examples/guide/i18n.md create mode 100644 .agents/skills/uview-pro-vue3/examples/guide/installation.md create mode 100644 .agents/skills/uview-pro-vue3/examples/guide/intro.md create mode 100644 .agents/skills/uview-pro-vue3/examples/guide/quick-start.md create mode 100644 .agents/skills/uview-pro-vue3/examples/guide/theme.md create mode 100644 .agents/skills/uview-pro-vue3/examples/layout/intro.md create mode 100644 .agents/skills/uview-pro-vue3/examples/tools/http.md create mode 100644 .agents/skills/uview-pro-vue3/examples/tools/intro.md create mode 100644 .agents/skills/uview-pro-vue3/templates/component-usage.md create mode 100644 .agents/skills/uview-pro-vue3/templates/installation.md create mode 100644 .agents/skills/uview-pro-vue3/templates/project-setup.md create mode 100644 .changeset/README.md create mode 100644 .changeset/config.json create mode 100644 .commitlintrc.cjs create mode 100644 .cursor/rules/api-http-patterns.mdc create mode 100644 .cursor/rules/development-workflow.mdc create mode 100644 .cursor/rules/project-overview.mdc create mode 100644 .cursor/rules/styling-css-patterns.mdc create mode 100644 .cursor/rules/uni-app-patterns.mdc create mode 100644 .cursor/rules/vue-typescript-patterns.mdc create mode 100644 .editorconfig create mode 100644 .gitignore create mode 100644 .husky/commit-msg create mode 100644 .husky/pre-commit create mode 100644 .npmrc create mode 100644 .vscode/extensions.json create mode 100644 .vscode/settings.json create mode 100644 .vscode/vue3.code-snippets create mode 100644 AGENTS.md create mode 100644 LICENSE create mode 100644 README.md create mode 100644 env/.env create mode 100644 env/.env.development create mode 100644 env/.env.production create mode 100644 env/.env.test create mode 100644 eslint.config.mjs create mode 100644 favicon.ico create mode 100644 hermes/README.md create mode 100644 hermes/api.md create mode 100644 hermes/architecture.md create mode 100644 hermes/conventions.md create mode 100644 hermes/performance.md create mode 100644 hermes/platforms.md create mode 100644 hermes/release.md create mode 100644 hermes/sop-new-page.md create mode 100644 index.html create mode 100644 manifest.config.ts create mode 100644 openapi-ts-request.config.ts create mode 100644 package.json create mode 100644 pages.config.ts create mode 100644 pnpm-lock.yaml create mode 100644 scripts/bump-version.js create mode 100644 scripts/create-base-files.js create mode 100644 scripts/open-dev-tools.js create mode 100644 scripts/postupgrade.js create mode 100644 scripts/upload-weixin.js create mode 100644 scripts/vite-plugin-eruda.js create mode 100644 src/App.ku.vue create mode 100644 src/App.vue create mode 100644 src/api/foo-alova.ts create mode 100644 src/api/foo.ts create mode 100644 src/api/login.ts create mode 100644 src/api/types/login.ts create mode 100644 src/components/.gitkeep create mode 100644 src/components/qiun-data-charts/config-echarts.js create mode 100644 src/components/qiun-data-charts/config-ucharts.js create mode 100644 src/components/qiun-data-charts/qiun-data-charts.vue create mode 100644 src/components/qiun-data-charts/u-charts.js create mode 100644 src/components/qiun-error/qiun-error.vue create mode 100644 src/components/qiun-loading/loading1.vue create mode 100644 src/components/qiun-loading/loading2.vue create mode 100644 src/components/qiun-loading/loading3.vue create mode 100644 src/components/qiun-loading/loading4.vue create mode 100644 src/components/qiun-loading/loading5.vue create mode 100644 src/components/qiun-loading/qiun-loading.vue create mode 100644 src/components/qiun-title-bar/qiun-title-bar.vue create mode 100644 src/env.d.ts create mode 100644 src/hooks/useRequest.test.ts create mode 100644 src/hooks/useRequest.ts create mode 100644 src/hooks/useScroll.md create mode 100644 src/hooks/useScroll.ts create mode 100644 src/hooks/useUpload.ts create mode 100644 src/http/README.md create mode 100644 src/http/alova.ts create mode 100644 src/http/http.ts create mode 100644 src/http/interceptor.ts create mode 100644 src/http/tools/enum.ts create mode 100644 src/http/tools/queryString.ts create mode 100644 src/http/types.ts create mode 100644 src/http/vue-query.ts create mode 100644 src/layouts/default.vue create mode 100644 src/locale/README.md create mode 100644 src/locale/en.json create mode 100644 src/locale/index.ts create mode 100644 src/locale/zh-Hans.json create mode 100644 src/main.ts create mode 100644 src/pages-demo/ucharts/data.json create mode 100644 src/pages-demo/ucharts/index.vue create mode 100644 src/pages/auth/README.md create mode 100644 src/pages/auth/login.vue create mode 100644 src/pages/auth/register.vue create mode 100644 src/pages/index/index.vue create mode 100644 src/pages/tabbar/about/about.vue create mode 100644 src/pages/tabbar/category/category.vue create mode 100644 src/pages/tabbar/gallery/gallery.vue create mode 100644 src/pages/tabbar/home/home.vue create mode 100644 src/pages/tabbar/moments/moments.vue create mode 100644 src/router/README.md create mode 100644 src/router/config.ts create mode 100644 src/router/interceptor.ts create mode 100644 src/router/permission.ts create mode 100644 src/service/index.ts create mode 100644 src/service/info.ts create mode 100644 src/service/listAll.ts create mode 100644 src/service/types.ts create mode 100644 src/static/app/icons/1024x1024.png create mode 100644 src/static/app/icons/120x120.png create mode 100644 src/static/app/icons/144x144.png create mode 100644 src/static/app/icons/152x152.png create mode 100644 src/static/app/icons/167x167.png create mode 100644 src/static/app/icons/180x180.png create mode 100644 src/static/app/icons/192x192.png create mode 100644 src/static/app/icons/20x20.png create mode 100644 src/static/app/icons/29x29.png create mode 100644 src/static/app/icons/40x40.png create mode 100644 src/static/app/icons/58x58.png create mode 100644 src/static/app/icons/60x60.png create mode 100644 src/static/app/icons/72x72.png create mode 100644 src/static/app/icons/76x76.png create mode 100644 src/static/app/icons/80x80.png create mode 100644 src/static/app/icons/87x87.png create mode 100644 src/static/app/icons/96x96.png create mode 100644 src/static/images/avatar.jpg create mode 100644 src/static/images/default-avatar.png create mode 100644 src/static/logo.svg create mode 100644 src/static/my-icons/copyright.svg create mode 100644 src/static/tabbar/select_category.png create mode 100644 src/static/tabbar/select_category_active.png create mode 100644 src/static/tabbar/select_gallery.png create mode 100644 src/static/tabbar/select_gallery_active.png create mode 100644 src/static/tabbar/select_home.png create mode 100644 src/static/tabbar/select_home_active.png create mode 100644 src/static/tabbar/select_links.png create mode 100644 src/static/tabbar/select_links_active.png create mode 100644 src/static/tabbar/select_mine.png create mode 100644 src/static/tabbar/select_mine_active.png create mode 100644 src/store/index.ts create mode 100644 src/store/token.ts create mode 100644 src/store/user.test.ts create mode 100644 src/store/user.ts create mode 100644 src/style/iconfont.css create mode 100644 src/style/index.scss create mode 100644 src/tabbar/README.md create mode 100644 src/tabbar/TabbarItem.test.ts create mode 100644 src/tabbar/TabbarItem.vue create mode 100644 src/tabbar/config.ts create mode 100644 src/tabbar/i18n.ts create mode 100644 src/tabbar/index.vue create mode 100644 src/tabbar/store.ts create mode 100644 src/tabbar/types.ts create mode 100644 src/test-setup.ts create mode 100644 src/typings.d.ts create mode 100644 src/typings.ts create mode 100644 src/uni.scss create mode 100644 src/uni_modules/.gitkeep create mode 100644 src/utils/debounce.test.ts create mode 100644 src/utils/debounce.ts create mode 100644 src/utils/i18n.ts create mode 100644 src/utils/index.ts create mode 100644 src/utils/systemInfo.ts create mode 100644 src/utils/toLoginPage.ts create mode 100644 src/utils/updateManager.wx.ts create mode 100644 src/utils/uploadFile.ts create mode 100644 tsconfig.json create mode 100644 uno.config.ts create mode 100644 vite-plugins/README.md create mode 100644 vite-plugins/copy-native-resources.ts create mode 100644 vite-plugins/sync-manifest-plugins.ts create mode 100644 vite.config.ts create mode 100644 vitest.config.ts create mode 100644 wot-ui-resolver.ts diff --git a/.agents/README.md b/.agents/README.md new file mode 100644 index 0000000..77ea947 --- /dev/null +++ b/.agents/README.md @@ -0,0 +1,40 @@ +# uni-app Skills 目录 + +不要一次全部加载,根据当前任务场景查找下表,只导入对应的 skill(读取其 `SKILL.md`),再按其中指引加载 references/examples。 + +大部分AI IDE 默认支持 skills目录,不识别可以在 `.claude/skills`等目录下引用该目录文件,用于指引 AI 搜索。 + +有不懂的地方可以微信群询问。我也在里面。skills不是必须的,不需要可以迁移到bak-skills中 + +## 按需导入速查表 + +| 任务场景 | 导入 skill | 路径 | +|---|---|---| +| uni-app 框架基础(项目结构、条件编译、pages.json/manifest.json 配置) | `uni-app` | `./uni-app/SKILL.md` | +| uni-app 内置组件 / uni-ui 组件 / 各类 API(网络、存储、设备等),逐组件逐 API 示例 | `uniapp-project` | `./uniapp-project/SKILL.md` | +| 一条命令创建 uni-app 新项目(CLI / HBuilderX) | `uniapp-project-creator` | `./uniapp-project-creator/SKILL.md` | +| uni-app 小程序平台配置、组件与 API 兼容性 | `uniapp-mini-guide` | `./uniapp-mini-guide/SKILL.md` | +| 小程序/App 打包发布、平台限制 | `uniapp-mini-guide` | `./uniapp-mini-guide/SKILL.md` | +| uni-app 离线打包为原生 Android/iOS App(签名、证书、原生配置) | `uniapp-native-app` | `./uniapp-native-app/SKILL.md` | +| 开发 uni-app 原生插件(Android/iOS 原生模块、插件通信、发布) | `uniapp-native-plugin` | `./uniapp-native-plugin/SKILL.md` | +| 插件市场浏览、自动安装插件、第三方插件集成 | `uniapp-plugin` | `./uniapp-plugin/SKILL.md` | +| uniCloud 云开发(云数据库、云函数、云存储、datacom、权限) | `uniapp-cloud` | `./uniapp-cloud/SKILL.md` | +| uni-ad 广告变现(banner/激励视频/插屏等广告类型与事件) | `uniapp-ad` | `./uniapp-ad/SKILL.md` | +| 在 uni-app 中集成 uCharts 图表 | `uniapp-ucharts` | `./uniapp-ucharts/SKILL.md` | +| 在 uni-app 中集成 uView UI 组件库 | `uniapp-uview` | `./uniapp-uview/SKILL.md` | +| uView Pro(Vue 3 版)组件、工具、布局模板 | `uview-pro-vue3` | `./uview-pro-vue3/SKILL.md` | +| uni-app-x 内置组件 / API(Vue 3 + TS + Vite,UTS) | `uniappx-project` | `./uniappx-project/SKILL.md` | +| 一条命令创建 uni-app-x 新项目 | `uniappx-project-creator` | `./uniappx-project-creator/SKILL.md` | +| 在 uni-app-x 中集成 uView Pro | `uniappx-uview-pro` | `./uniappx-uview-pro/SKILL.md` | + +## 导入规则 + +1. **先匹配场景,再导入**:只读取命中场景的 `SKILL.md`,不预加载整个目录。 +2. **一个任务可能命中多个 skill**:例如「uni-app 项目里用 uView 做图表」→ `uniapp-project` + `uniapp-uview`(+ `uniapp-ucharts` 若涉及图表)。逐个按需导入。 +3. **优先级**:本项目(unibest)是 uni-app + Vue3 + Vite 项目,日常开发默认命中 `uni-app` / `uniapp-project`;涉及 uni-app-x 的 skill 仅在明确开发 uni-app-x 时导入。 +4. **skill 内部同样按需加载**:`SKILL.md` 只是指引,其 references/、examples/、api/ 子文件按当前具体问题再读取,避免上下文膨胀。 + +## 区分易混淆项 + +- `uniapp-uview` vs `uview-pro-vue3` vs `uniappx-uview-pro`:分别对应 uView 1.x/2.x(uni-app)、uView Pro(Vue 3)、uView Pro(uni-app-x)。按项目技术栈选择。 +- `uniapp-project-creator` vs `uniappx-project-creator`:创建 uni-app 项目用前者,创建 uni-app-x(UTS)项目用后者。 diff --git a/.agents/bak-skills/uniapp-ad/LICENSE.txt b/.agents/bak-skills/uniapp-ad/LICENSE.txt new file mode 100644 index 0000000..b03965a --- /dev/null +++ b/.agents/bak-skills/uniapp-ad/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 partme-ai + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/.agents/bak-skills/uniapp-ad/SKILL.md b/.agents/bak-skills/uniapp-ad/SKILL.md new file mode 100644 index 0000000..1604dbd --- /dev/null +++ b/.agents/bak-skills/uniapp-ad/SKILL.md @@ -0,0 +1,108 @@ +--- +name: uniapp-ad +description: A comprehensive skill for uni-ad monetization in uni-app. Use this skill to integrate ads, configure ad types, handle ad events, and follow official uni-ad documentation. +license: Complete terms in LICENSE.txt +--- + +## When to use this skill + +Use this skill whenever the user wants to: +- Integrate ads into uni-app +- Implement ad monetization +- Configure different ad types (banner, interstitial, rewarded video, etc.) +- Handle ad events (load, show, close, error) +- Optimize ad revenue +- Set up ad placement and timing +- Handle ad policies and compliance + +## How to use this skill + +To integrate ads: + +1. **Identify the ad type** from the user's request: + - Banner ads → Use banner examples + - Interstitial ads → Use interstitial examples + - Rewarded video → Use rewarded video examples + - Native ads → Use native ad examples + +2. **Load the appropriate example file** from the `examples/` directory: + - `examples/guide/` - Ad integration guide + - `examples/ad-types/` - Different ad type examples + - `examples/integration/` - Integration examples + +3. **Load the appropriate API reference** from the `api/` directory: + - `api/ad-api.md` - uni-ad API reference + +4. **Follow the specific instructions** in those files for integration + +## Examples and Templates + +### Examples + +Located in `examples/`: + +- **guide/** - Ad integration guide and setup +- **ad-types/** - Different ad type examples (banner, interstitial, rewarded video, etc.) +- **integration/** - Integration examples and best practices + +### API Reference + +Located in `api/`: + +- **ad-api.md** - Complete uni-ad API reference + +## Best Practices + +1. **User experience**: Don't interrupt user experience with excessive ads +2. **Ad placement**: Place ads strategically for maximum revenue +3. **Loading**: Handle ad loading states properly +4. **Error handling**: Implement proper error handling for ad failures +5. **Compliance**: Follow ad policies and regulations + +## Resources + +- **Official Documentation**: https://uniapp.dcloud.net.cn/uni-ad/ + +## Keywords + +uni-ad, 广告变现, banner广告, 激励视频, 插屏广告, ad monetization, ad integration + +## 能力边界 + +### ✅ 适用场景 +- 当你需要使用此技能对应的技术栈时 +- 当项目需要遵循最佳实践时 +- 当需要快速上手或深入理解核心概念时 + +### ⚠️ 需要注意 +- 复杂业务逻辑需要结合具体场景调整 +- 性能优化需要根据实际数据量评估 + +### ❌ 不适用场景 +- 不相关的技术栈或框架 +- 需要完全自定义的特殊场景 + +## 常见陷阱 (Gotchas) + +1. **版本兼容性**:注意框架版本与依赖库的兼容性,不同版本 API 可能有差异 +2. **配置文件格式**:配置文件格式错误是最常见的问题,建议使用编辑器的语法检查 +3. **环境变量**:确保所有必要的环境变量已正确设置,敏感信息不要硬编码 +4. **依赖冲突**:多版本共存时注意依赖冲突,使用 lock 文件锁定版本 +5. **性能陷阱**:大数据量场景下注意性能优化,避免 N+1 查询等常见问题 + +## 使用流程 + +### Step 1: 环境准备 +确保开发环境已安装必要的依赖和工具。 + +### Step 2: 配置初始化 +根据项目需求进行基础配置。 + +### Step 3: 核心功能使用 +按照示例代码实现核心功能。 + +### Step 4: 测试验证 +运行测试确保功能正常。 + +### Step 5: 部署上线 +完成开发后进行部署和监控。 diff --git a/.agents/bak-skills/uniapp-ad/api/ad-api.md b/.agents/bak-skills/uniapp-ad/api/ad-api.md new file mode 100644 index 0000000..2930b82 --- /dev/null +++ b/.agents/bak-skills/uniapp-ad/api/ad-api.md @@ -0,0 +1,15 @@ +# uni-ad API 参考 + +## 官方文档 + +参考官方文档:https://uniapp.dcloud.net.cn/uni-ad/ + +## 常用 API + +- `uni.createRewardedVideoAd` +- `uni.createInterstitialAd` +- `uni.createBannerAd` + +## 参考资源 + +- https://uniapp.dcloud.net.cn/uni-ad/ diff --git a/.agents/bak-skills/uniapp-ad/examples/ad-types/banner.md b/.agents/bak-skills/uniapp-ad/examples/ad-types/banner.md new file mode 100644 index 0000000..7ad4b07 --- /dev/null +++ b/.agents/bak-skills/uniapp-ad/examples/ad-types/banner.md @@ -0,0 +1,17 @@ +# Banner 广告 + +## 官方文档 + +参考官方文档:https://uniapp.dcloud.net.cn/uni-ad/ + +## 示例 + +```vue + +``` + +## 参考资源 + +- https://uniapp.dcloud.net.cn/uni-ad/ diff --git a/.agents/bak-skills/uniapp-ad/examples/ad-types/interstitial.md b/.agents/bak-skills/uniapp-ad/examples/ad-types/interstitial.md new file mode 100644 index 0000000..8b248d7 --- /dev/null +++ b/.agents/bak-skills/uniapp-ad/examples/ad-types/interstitial.md @@ -0,0 +1,18 @@ +# 插屏广告 + +## 官方文档 + +参考官方文档:https://uniapp.dcloud.net.cn/uni-ad/ + +## 示例 + +```javascript +const interstitial = uni.createInterstitialAd({ + adUnitId: 'YOUR_AD_UNIT_ID' +}) +interstitial.show() +``` + +## 参考资源 + +- https://uniapp.dcloud.net.cn/uni-ad/ diff --git a/.agents/bak-skills/uniapp-ad/examples/ad-types/native.md b/.agents/bak-skills/uniapp-ad/examples/ad-types/native.md new file mode 100644 index 0000000..5f5e5ce --- /dev/null +++ b/.agents/bak-skills/uniapp-ad/examples/ad-types/native.md @@ -0,0 +1,14 @@ +# 原生广告 + +## 官方文档 + +参考官方文档:https://uniapp.dcloud.net.cn/uni-ad/ + +## 说明 + +- 原生广告需结合广告位与样式进行自定义渲染 +- 注意广告标识与合规要求 + +## 参考资源 + +- https://uniapp.dcloud.net.cn/uni-ad/ diff --git a/.agents/bak-skills/uniapp-ad/examples/ad-types/rewarded-video.md b/.agents/bak-skills/uniapp-ad/examples/ad-types/rewarded-video.md new file mode 100644 index 0000000..53c3c3e --- /dev/null +++ b/.agents/bak-skills/uniapp-ad/examples/ad-types/rewarded-video.md @@ -0,0 +1,18 @@ +# 激励视频广告 + +## 官方文档 + +参考官方文档:https://uniapp.dcloud.net.cn/uni-ad/ + +## 示例 + +```javascript +const rewarded = uni.createRewardedVideoAd({ + adUnitId: 'YOUR_AD_UNIT_ID' +}) +rewarded.show() +``` + +## 参考资源 + +- https://uniapp.dcloud.net.cn/uni-ad/ diff --git a/.agents/bak-skills/uniapp-ad/examples/guide/intro.md b/.agents/bak-skills/uniapp-ad/examples/guide/intro.md new file mode 100644 index 0000000..a3b39c4 --- /dev/null +++ b/.agents/bak-skills/uniapp-ad/examples/guide/intro.md @@ -0,0 +1,20 @@ +# uni-ad 接入概览 + +## 官方文档 + +参考官方文档:https://uniapp.dcloud.net.cn/uni-ad/ + +## 适用场景 + +- 在 uni-app 中进行广告变现 +- 需要集成 banner、插屏、激励视频等广告类型 + +## 基本流程 + +1. 开通 uni-ad +2. 获取广告位 ID +3. 在页面中引入广告组件或 API + +## 参考资源 + +- https://uniapp.dcloud.net.cn/uni-ad/ diff --git a/.agents/bak-skills/uniapp-ad/examples/integration/config.md b/.agents/bak-skills/uniapp-ad/examples/integration/config.md new file mode 100644 index 0000000..1b89c62 --- /dev/null +++ b/.agents/bak-skills/uniapp-ad/examples/integration/config.md @@ -0,0 +1,14 @@ +# 广告位配置 + +## 官方文档 + +参考官方文档:https://uniapp.dcloud.net.cn/uni-ad/ + +## 配置要点 + +- 在平台配置广告位 ID +- 根据平台选择合适广告类型 + +## 参考资源 + +- https://uniapp.dcloud.net.cn/uni-ad/ diff --git a/.agents/bak-skills/uniapp-ad/examples/integration/events.md b/.agents/bak-skills/uniapp-ad/examples/integration/events.md new file mode 100644 index 0000000..815d082 --- /dev/null +++ b/.agents/bak-skills/uniapp-ad/examples/integration/events.md @@ -0,0 +1,23 @@ +# 广告事件处理 + +## 官方文档 + +参考官方文档:https://uniapp.dcloud.net.cn/uni-ad/ + +## 示例 + +```javascript +rewarded.onLoad(() => { + console.log('广告加载成功') +}) +rewarded.onError(err => { + console.error('广告加载失败', err) +}) +rewarded.onClose(res => { + console.log('广告关闭', res) +}) +``` + +## 参考资源 + +- https://uniapp.dcloud.net.cn/uni-ad/ diff --git a/.agents/bak-skills/uniapp-cloud/LICENSE.txt b/.agents/bak-skills/uniapp-cloud/LICENSE.txt new file mode 100644 index 0000000..b03965a --- /dev/null +++ b/.agents/bak-skills/uniapp-cloud/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 partme-ai + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/.agents/bak-skills/uniapp-cloud/SKILL.md b/.agents/bak-skills/uniapp-cloud/SKILL.md new file mode 100644 index 0000000..086d713 --- /dev/null +++ b/.agents/bak-skills/uniapp-cloud/SKILL.md @@ -0,0 +1,113 @@ +--- +name: uniapp-cloud +description: A comprehensive skill for uniCloud cloud development in the uni-app ecosystem. Use this skill when you need uniCloud project setup, cloud database CRUD, cloud functions, storage, or datacom components, following official uniCloud documentation. +license: Complete terms in LICENSE.txt +--- + +## When to use this skill + +Use this skill whenever the user wants to: +- Use uniCloud cloud development services +- Work with cloud databases (add, query, update, delete data) +- Create and deploy cloud functions +- Use cloud storage for file uploads and management +- Implement datacom components for data binding +- Integrate backend services with uni-app +- Set up uniCloud project and configuration +- Handle cloud database permissions and security + +## How to use this skill + +This skill is organized to match the official uniCloud documentation: + +1. **Start with setup and project configuration**: + - `examples/guide/intro.md` + - `examples/guide/project-setup.md` + - `examples/guide/cloud-space.md` + +2. **Choose the cloud capability**: + - Database → `examples/database/` + - Cloud functions → `examples/functions/` + - Storage → `examples/storage/` + - Datacom → `examples/datacom/` + - Security/permission → `examples/security/` + +3. **Open the API reference**: + - `api/cloud-api.md` + +**Important Notes**: +- This skill focuses on uniCloud integration and usage, not general backend frameworks +- Each example includes official documentation URL +- Follow official permission and security guidance for production + +## Examples and Templates + +### Examples + +Located in `examples/`: + +- **guide/** - Intro, project setup, cloud space creation +- **database/** - CRUD, query, index, permissions +- **functions/** - Function structure, deploy, call +- **storage/** - Upload, download, delete +- **datacom/** - datacom components and binding +- **security/** - permissions and security rules + +## Best Practices + +1. **Security**: Always set proper database permissions and rules +2. **Performance**: Use indexes for frequently queried fields +3. **Cost**: Optimize cloud function execution time +4. **Error handling**: Implement proper error handling for all cloud operations +5. **Data validation**: Validate data before saving to database + +## Resources + +- **Official Documentation**: https://doc.dcloud.net.cn/uniCloud/ +- **Cloud Database**: https://doc.dcloud.net.cn/uniCloud/database.html +- **Cloud Functions**: https://doc.dcloud.net.cn/uniCloud/cf-functions.html +- **Cloud Storage**: https://doc.dcloud.net.cn/uniCloud/storage.html + +## Keywords + +unicloud, uniCloud, cloud development, cloud database, cloud functions, cloud storage, datacom, 云开发, 云数据库, 云函数, 云存储 + +## 能力边界 + +### ✅ 适用场景 +- 当你需要使用此技能对应的技术栈时 +- 当项目需要遵循最佳实践时 +- 当需要快速上手或深入理解核心概念时 + +### ⚠️ 需要注意 +- 复杂业务逻辑需要结合具体场景调整 +- 性能优化需要根据实际数据量评估 + +### ❌ 不适用场景 +- 不相关的技术栈或框架 +- 需要完全自定义的特殊场景 + +## 常见陷阱 (Gotchas) + +1. **版本兼容性**:注意框架版本与依赖库的兼容性,不同版本 API 可能有差异 +2. **配置文件格式**:配置文件格式错误是最常见的问题,建议使用编辑器的语法检查 +3. **环境变量**:确保所有必要的环境变量已正确设置,敏感信息不要硬编码 +4. **依赖冲突**:多版本共存时注意依赖冲突,使用 lock 文件锁定版本 +5. **性能陷阱**:大数据量场景下注意性能优化,避免 N+1 查询等常见问题 + +## 使用流程 + +### Step 1: 环境准备 +确保开发环境已安装必要的依赖和工具。 + +### Step 2: 配置初始化 +根据项目需求进行基础配置。 + +### Step 3: 核心功能使用 +按照示例代码实现核心功能。 + +### Step 4: 测试验证 +运行测试确保功能正常。 + +### Step 5: 部署上线 +完成开发后进行部署和监控。 diff --git a/.agents/bak-skills/uniapp-cloud/api/cloud-api.md b/.agents/bak-skills/uniapp-cloud/api/cloud-api.md new file mode 100644 index 0000000..623a4d6 --- /dev/null +++ b/.agents/bak-skills/uniapp-cloud/api/cloud-api.md @@ -0,0 +1,121 @@ +# uniCloud API 参考 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uniCloud/ + +## 云数据库 API + +### 获取数据库引用 + +```javascript +const db = uniCloud.database() +``` + +### 获取集合引用 + +```javascript +const collection = db.collection('users') +``` + +### 查询数据 + +```javascript +// 获取所有数据 +collection.get().then(res => { + console.log(res.data) +}) + +// 条件查询 +collection.where({ + age: db.command.gt(18) +}).get().then(res => { + console.log(res.data) +}) + +// 分页查询 +collection.skip(0).limit(10).get().then(res => { + console.log(res.data) +}) +``` + +### 添加数据 + +```javascript +collection.add({ + name: 'John', + age: 25 +}).then(res => { + console.log(res.id) +}) +``` + +### 更新数据 + +```javascript +collection.doc('doc-id').update({ + age: 26 +}).then(res => { + console.log('更新成功') +}) +``` + +### 删除数据 + +```javascript +collection.doc('doc-id').remove().then(res => { + console.log('删除成功') +}) +``` + +## 云函数 API + +### 调用云函数 + +```javascript +uniCloud.callFunction({ + name: 'function-name', + data: { + param1: 'value1' + } +}).then(res => { + console.log(res.result) +}) +``` + +## 云存储 API + +### 上传文件 + +```javascript +uniCloud.uploadFile({ + filePath: 'path/to/file', + cloudPath: 'cloud/path/file.jpg' +}).then(res => { + console.log(res.fileID) +}) +``` + +### 下载文件 + +```javascript +uniCloud.downloadFile({ + fileID: 'cloud://xxx.jpg' +}).then(res => { + console.log(res.tempFilePath) +}) +``` + +### 删除文件 + +```javascript +uniCloud.deleteFile({ + fileList: ['cloud://xxx.jpg'] +}).then(res => { + console.log('删除成功') +}) +``` + +## 参考资源 + +- uniCloud API 文档:https://doc.dcloud.net.cn/uniCloud/client-sdk.html diff --git a/.agents/bak-skills/uniapp-cloud/examples/database/crud.md b/.agents/bak-skills/uniapp-cloud/examples/database/crud.md new file mode 100644 index 0000000..6509f7f --- /dev/null +++ b/.agents/bak-skills/uniapp-cloud/examples/database/crud.md @@ -0,0 +1,45 @@ +# 云数据库 CRUD + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uniCloud/database.html + +## 新增数据 + +```javascript +const db = uniCloud.database() +const users = db.collection('users') + +users.add({ + name: 'Alice', + age: 20 +}).then(res => { + console.log('新增 ID', res.id) +}) +``` + +## 查询数据 + +```javascript +users.get().then(res => { + console.log(res.data) +}) +``` + +## 更新数据 + +```javascript +users.doc('doc-id').update({ + age: 21 +}) +``` + +## 删除数据 + +```javascript +users.doc('doc-id').remove() +``` + +## 参考资源 + +- https://doc.dcloud.net.cn/uniCloud/database.html diff --git a/.agents/bak-skills/uniapp-cloud/examples/database/indexes.md b/.agents/bak-skills/uniapp-cloud/examples/database/indexes.md new file mode 100644 index 0000000..a702ad6 --- /dev/null +++ b/.agents/bak-skills/uniapp-cloud/examples/database/indexes.md @@ -0,0 +1,19 @@ +# 云数据库索引 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uniCloud/database.html + +## 使用场景 + +- 提升高频查询性能 +- 支持复合索引提升多条件查询效率 + +## 示例 + +- 在 uniCloud 控制台为集合创建索引 +- 为常用的查询字段(如 userId、createdAt)建立索引 + +## 参考资源 + +- https://doc.dcloud.net.cn/uniCloud/database.html diff --git a/.agents/bak-skills/uniapp-cloud/examples/database/permissions.md b/.agents/bak-skills/uniapp-cloud/examples/database/permissions.md new file mode 100644 index 0000000..e68efd5 --- /dev/null +++ b/.agents/bak-skills/uniapp-cloud/examples/database/permissions.md @@ -0,0 +1,23 @@ +# 云数据库权限控制 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uniCloud/ + +## 说明 + +- 通过数据库权限规则限制读写 +- 配合用户身份(如用户登录态)实现访问控制 + +## 示例(规则示意) + +```json +{ + "read": true, + "write": "auth.uid == _id" +} +``` + +## 参考资源 + +- https://doc.dcloud.net.cn/uniCloud/ diff --git a/.agents/bak-skills/uniapp-cloud/examples/database/query.md b/.agents/bak-skills/uniapp-cloud/examples/database/query.md new file mode 100644 index 0000000..67f7069 --- /dev/null +++ b/.agents/bak-skills/uniapp-cloud/examples/database/query.md @@ -0,0 +1,40 @@ +# 云数据库查询 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uniCloud/database.html + +## 条件查询 + +```javascript +const db = uniCloud.database() +const users = db.collection('users') + +users.where({ + age: db.command.gt(18) +}).get().then(res => { + console.log(res.data) +}) +``` + +## 排序与分页 + +```javascript +users.orderBy('createdAt', 'desc') + .skip(0) + .limit(10) + .get() +``` + +## 字段筛选 + +```javascript +users.field({ + name: true, + age: true +}).get() +``` + +## 参考资源 + +- https://doc.dcloud.net.cn/uniCloud/database.html diff --git a/.agents/bak-skills/uniapp-cloud/examples/datacom/intro.md b/.agents/bak-skills/uniapp-cloud/examples/datacom/intro.md new file mode 100644 index 0000000..0b5f406 --- /dev/null +++ b/.agents/bak-skills/uniapp-cloud/examples/datacom/intro.md @@ -0,0 +1,18 @@ +# datacom 组件与数据绑定 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uniCloud/ + +## 使用场景 + +- 快速绑定云数据库数据 +- 通过组件实现低代码数据展示 + +## 说明 + +在 uniCloud 体系中,datacom 组件用于快速构建数据列表、详情页等场景。使用时需关注组件配置、数据源与权限规则。 + +## 参考资源 + +- https://doc.dcloud.net.cn/uniCloud/ diff --git a/.agents/bak-skills/uniapp-cloud/examples/functions/call-function.md b/.agents/bak-skills/uniapp-cloud/examples/functions/call-function.md new file mode 100644 index 0000000..0839a68 --- /dev/null +++ b/.agents/bak-skills/uniapp-cloud/examples/functions/call-function.md @@ -0,0 +1,20 @@ +# 云函数调用 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uniCloud/cf-functions.html + +## 前端调用示例 + +```javascript +uniCloud.callFunction({ + name: 'getUser', + data: { userId: '123' } +}).then(res => { + console.log(res.result) +}) +``` + +## 参考资源 + +- https://doc.dcloud.net.cn/uniCloud/cf-functions.html diff --git a/.agents/bak-skills/uniapp-cloud/examples/functions/create-function.md b/.agents/bak-skills/uniapp-cloud/examples/functions/create-function.md new file mode 100644 index 0000000..37edc9c --- /dev/null +++ b/.agents/bak-skills/uniapp-cloud/examples/functions/create-function.md @@ -0,0 +1,25 @@ +# 云函数创建 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uniCloud/cf-functions.html + +## 创建云函数 + +1. 在项目根目录创建 `cloudfunctions/`。 +2. 新建函数目录(如 `getUser`)。 +3. 编写 `index.js` 入口。 + +```javascript +'use strict' +exports.main = async (event, context) => { + return { + code: 0, + data: 'Hello uniCloud' + } +} +``` + +## 参考资源 + +- https://doc.dcloud.net.cn/uniCloud/cf-functions.html diff --git a/.agents/bak-skills/uniapp-cloud/examples/guide/cloud-space.md b/.agents/bak-skills/uniapp-cloud/examples/guide/cloud-space.md new file mode 100644 index 0000000..bb3aaff --- /dev/null +++ b/.agents/bak-skills/uniapp-cloud/examples/guide/cloud-space.md @@ -0,0 +1,28 @@ +# 云服务空间创建与关联 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uniCloud/ + +## 创建服务空间 + +1. 登录 DCloud 开发者中心。 +2. 进入 uniCloud 控制台。 +3. 新建服务空间(选择阿里云或腾讯云)。 + +## 关联服务空间 + +在 HBuilderX 中: + +1. 右键项目 → `uniCloud` → `关联云服务空间`。 +2. 选择服务空间与云服务商。 +3. 关联完成后即可使用云数据库、云函数、云存储。 + +## 注意事项 + +- 不同云服务商的配额、费用与功能存在差异。 +- 建议为不同环境(开发/测试/生产)创建独立空间。 + +## 参考资源 + +- https://doc.dcloud.net.cn/uniCloud/ diff --git a/.agents/bak-skills/uniapp-cloud/examples/guide/intro.md b/.agents/bak-skills/uniapp-cloud/examples/guide/intro.md new file mode 100644 index 0000000..6bed14b --- /dev/null +++ b/.agents/bak-skills/uniapp-cloud/examples/guide/intro.md @@ -0,0 +1,104 @@ +# uniCloud 云开发指南 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uniCloud/ + +## 什么是 uniCloud + +uniCloud 是 DCloud 联合阿里云、腾讯云,为 uni-app 开发者提供的基于 serverless 模式和 js 编程的云开发平台。 + +## 核心功能 + +### 1. 云数据库 + +- 无需自建数据库 +- 自动扩容 +- 支持 JSON 文档存储 +- 支持关系型数据 + +### 2. 云函数 + +- 无需管理服务器 +- 按量计费 +- 支持 Node.js +- 自动扩缩容 + +### 3. 云存储 + +- 文件上传下载 +- CDN 加速 +- 图片处理 +- 安全防护 + +### 4. 前端网页托管 + +- 静态网站托管 +- CDN 加速 +- 自定义域名 + +## 服务空间 + +### 创建服务空间 + +1. 登录 DCloud 开发者中心 +2. 进入 uniCloud 控制台 +3. 创建服务空间 +4. 选择云服务商(阿里云/腾讯云) + +### 关联服务空间 + +在 HBuilderX 中: +1. 右键项目 → uniCloud → 关联云服务空间 +2. 选择服务空间 +3. 选择云服务商 + +## 项目结构 + +``` +my-uniapp-project/ +├── cloudfunctions/ # 云函数目录 +│ ├── function1/ +│ │ ├── index.js +│ │ └── package.json +│ └── ... +├── uniCloud/ +│ └── database/ # 数据库 schema +│ └── db_init.json +└── ... +``` + +## 快速开始 + +### 1. 创建服务空间 + +在 DCloud 开发者中心创建服务空间。 + +### 2. 关联服务空间 + +在 HBuilderX 中关联服务空间。 + +### 3. 初始化云数据库 + +```javascript +// 在 uniCloud 控制台创建数据表 +// 或使用 db_init.json 初始化 +``` + +### 4. 使用云数据库 + +```javascript +// 在页面中使用 +const db = uniCloud.database() +const collection = db.collection('users') + +collection.get().then(res => { + console.log(res.data) +}) +``` + +## 参考资源 + +- uniCloud 文档:https://doc.dcloud.net.cn/uniCloud/ +- 云数据库:https://doc.dcloud.net.cn/uniCloud/database.html +- 云函数:https://doc.dcloud.net.cn/uniCloud/cf-functions.html diff --git a/.agents/bak-skills/uniapp-cloud/examples/guide/project-setup.md b/.agents/bak-skills/uniapp-cloud/examples/guide/project-setup.md new file mode 100644 index 0000000..c2ecd11 --- /dev/null +++ b/.agents/bak-skills/uniapp-cloud/examples/guide/project-setup.md @@ -0,0 +1,40 @@ +# uniCloud 项目初始化 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uniCloud/ + +## 使用场景 + +- 创建新 uni-app 项目并启用 uniCloud +- 为已有项目关联云服务空间 +- 初始化云函数与数据库目录 + +## 步骤 + +1. **创建或打开项目**(HBuilderX 或 CLI 项目均可)。 +2. **启用 uniCloud**: + - 在 HBuilderX 中右键项目 → `uniCloud` → `关联云服务空间`。 +3. **确认目录结构**: + +``` +my-uniapp-project/ +├── cloudfunctions/ # 云函数目录 +├── uniCloud/ # 云数据库与存储配置 +└── ... +``` + +4. **初始化云数据库**: + - 使用 `uniCloud/database` 下的 schema 或控制台创建集合。 + +## 示例 + +```javascript +// 获取数据库引用 +const db = uniCloud.database() +const collection = db.collection('users') +``` + +## 参考资源 + +- https://doc.dcloud.net.cn/uniCloud/ diff --git a/.agents/bak-skills/uniapp-cloud/examples/security/rules.md b/.agents/bak-skills/uniapp-cloud/examples/security/rules.md new file mode 100644 index 0000000..9bdedfa --- /dev/null +++ b/.agents/bak-skills/uniapp-cloud/examples/security/rules.md @@ -0,0 +1,24 @@ +# 权限与安全规则 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uniCloud/ + +## 关键点 + +- 按最小权限原则配置读写规则 +- 对敏感数据进行字段级控制 +- 使用用户身份信息限制访问范围 + +## 示例(规则示意) + +```json +{ + "read": "auth.uid != null", + "write": "auth.uid == _id" +} +``` + +## 参考资源 + +- https://doc.dcloud.net.cn/uniCloud/ diff --git a/.agents/bak-skills/uniapp-cloud/examples/storage/delete.md b/.agents/bak-skills/uniapp-cloud/examples/storage/delete.md new file mode 100644 index 0000000..2bdf698 --- /dev/null +++ b/.agents/bak-skills/uniapp-cloud/examples/storage/delete.md @@ -0,0 +1,17 @@ +# 云存储删除 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uniCloud/storage.html + +## 删除文件 + +```javascript +uniCloud.deleteFile({ + fileList: ['cloud://xxx/xxx.png'] +}) +``` + +## 参考资源 + +- https://doc.dcloud.net.cn/uniCloud/storage.html diff --git a/.agents/bak-skills/uniapp-cloud/examples/storage/download.md b/.agents/bak-skills/uniapp-cloud/examples/storage/download.md new file mode 100644 index 0000000..6d4e5cc --- /dev/null +++ b/.agents/bak-skills/uniapp-cloud/examples/storage/download.md @@ -0,0 +1,19 @@ +# 云存储下载 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uniCloud/storage.html + +## 获取临时链接 + +```javascript +uniCloud.getTempFileURL({ + fileList: ['cloud://xxx/xxx.png'] +}).then(res => { + console.log(res.fileList) +}) +``` + +## 参考资源 + +- https://doc.dcloud.net.cn/uniCloud/storage.html diff --git a/.agents/bak-skills/uniapp-cloud/examples/storage/upload.md b/.agents/bak-skills/uniapp-cloud/examples/storage/upload.md new file mode 100644 index 0000000..ce17bf8 --- /dev/null +++ b/.agents/bak-skills/uniapp-cloud/examples/storage/upload.md @@ -0,0 +1,20 @@ +# 云存储上传 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uniCloud/storage.html + +## 上传文件 + +```javascript +uniCloud.uploadFile({ + filePath: '/static/logo.png', + cloudPath: 'images/logo.png' +}).then(res => { + console.log('fileID:', res.fileID) +}) +``` + +## 参考资源 + +- https://doc.dcloud.net.cn/uniCloud/storage.html diff --git a/.agents/bak-skills/uniapp-mini-guide/LICENSE.txt b/.agents/bak-skills/uniapp-mini-guide/LICENSE.txt new file mode 100644 index 0000000..b03965a --- /dev/null +++ b/.agents/bak-skills/uniapp-mini-guide/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 partme-ai + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/.agents/bak-skills/uniapp-mini-guide/SKILL.md b/.agents/bak-skills/uniapp-mini-guide/SKILL.md new file mode 100644 index 0000000..784dc41 --- /dev/null +++ b/.agents/bak-skills/uniapp-mini-guide/SKILL.md @@ -0,0 +1,87 @@ +--- +name: uniapp-mini-guide +description: A comprehensive skill for uni-app mini program development. Use when building uni-app mini programs, configuring mini program settings, or working with mini program components and APIs based on the official native support docs. +license: Complete terms in LICENSE.txt +--- + +## When to use this skill + +Use this skill whenever the user wants to: +- Build uni-app mini programs +- Configure mini program settings and capabilities +- Use mini program components and APIs within uni-app +- Understand native mini program limitations and compatibility + +## How to use this skill + +1. **Start with the overview**: + - `examples/guide/intro.md` + +2. **Configure mini program settings**: + - `examples/guide/config.md` + +3. **Check component and API references**: + - `examples/components/overview.md` + - `examples/api/overview.md` + +## Examples and Templates + +- `examples/guide/intro.md` - Mini program overview +- `examples/guide/config.md` - Configuration and capability setup +- `examples/components/overview.md` - Component references and usage +- `examples/api/overview.md` - API references and usage + +## Best Practices + +1. Follow mini program platform requirements and audits +2. Keep package size small and optimize assets +3. Validate API compatibility per platform +4. Use conditional compilation for platform-specific code + +## Resources + +- https://nativesupport.dcloud.net.cn/ + +## Keywords + +uniapp, uni-app, mini program, 小程序, native support, components, api, 平台兼容 + +## 能力边界 + +### ✅ 适用场景 +- 当你需要使用此技能对应的技术栈时 +- 当项目需要遵循最佳实践时 +- 当需要快速上手或深入理解核心概念时 + +### ⚠️ 需要注意 +- 复杂业务逻辑需要结合具体场景调整 +- 性能优化需要根据实际数据量评估 + +### ❌ 不适用场景 +- 不相关的技术栈或框架 +- 需要完全自定义的特殊场景 + +## 常见陷阱 (Gotchas) + +1. **版本兼容性**:注意框架版本与依赖库的兼容性,不同版本 API 可能有差异 +2. **配置文件格式**:配置文件格式错误是最常见的问题,建议使用编辑器的语法检查 +3. **环境变量**:确保所有必要的环境变量已正确设置,敏感信息不要硬编码 +4. **依赖冲突**:多版本共存时注意依赖冲突,使用 lock 文件锁定版本 +5. **性能陷阱**:大数据量场景下注意性能优化,避免 N+1 查询等常见问题 + +## 使用流程 + +### Step 1: 环境准备 +确保开发环境已安装必要的依赖和工具。 + +### Step 2: 配置初始化 +根据项目需求进行基础配置。 + +### Step 3: 核心功能使用 +按照示例代码实现核心功能。 + +### Step 4: 测试验证 +运行测试确保功能正常。 + +### Step 5: 部署上线 +完成开发后进行部署和监控。 diff --git a/.agents/bak-skills/uniapp-mini-guide/examples/api/overview.md b/.agents/bak-skills/uniapp-mini-guide/examples/api/overview.md new file mode 100644 index 0000000..28ff37b --- /dev/null +++ b/.agents/bak-skills/uniapp-mini-guide/examples/api/overview.md @@ -0,0 +1,14 @@ +# 小程序 API 概览 + +## 官方文档 + +参考官方文档:https://nativesupport.dcloud.net.cn/ + +## 说明 + +- 本节用于对接小程序平台 API 与 uni-app API 的兼容性说明 +- 具体 API 能力请以官方文档为准 + +## 参考资源 + +- https://nativesupport.dcloud.net.cn/ diff --git a/.agents/bak-skills/uniapp-mini-guide/examples/components/overview.md b/.agents/bak-skills/uniapp-mini-guide/examples/components/overview.md new file mode 100644 index 0000000..c055d26 --- /dev/null +++ b/.agents/bak-skills/uniapp-mini-guide/examples/components/overview.md @@ -0,0 +1,14 @@ +# 小程序组件概览 + +## 官方文档 + +参考官方文档:https://nativesupport.dcloud.net.cn/ + +## 说明 + +- 本节用于对接小程序平台组件与 uni-app 组件的兼容性说明 +- 具体组件能力请以官方文档为准 + +## 参考资源 + +- https://nativesupport.dcloud.net.cn/ diff --git a/.agents/bak-skills/uniapp-mini-guide/examples/guide/config.md b/.agents/bak-skills/uniapp-mini-guide/examples/guide/config.md new file mode 100644 index 0000000..d7c18db --- /dev/null +++ b/.agents/bak-skills/uniapp-mini-guide/examples/guide/config.md @@ -0,0 +1,15 @@ +# 小程序配置与能力 + +## 官方文档 + +参考官方文档:https://nativesupport.dcloud.net.cn/ + +## 配置重点 + +- 平台权限与 capability 配置 +- 小程序审核所需配置项 +- Manifest 与平台参数 + +## 参考资源 + +- https://nativesupport.dcloud.net.cn/ diff --git a/.agents/bak-skills/uniapp-mini-guide/examples/guide/intro.md b/.agents/bak-skills/uniapp-mini-guide/examples/guide/intro.md new file mode 100644 index 0000000..5044ea0 --- /dev/null +++ b/.agents/bak-skills/uniapp-mini-guide/examples/guide/intro.md @@ -0,0 +1,20 @@ +# uni 小程序开发概览 + +## 官方文档 + +参考官方文档:https://nativesupport.dcloud.net.cn/ + +## 适用场景 + +- 使用 uni-app 开发微信/支付宝/百度等小程序 +- 需要了解小程序平台限制与能力 + +## 核心要点 + +- 小程序平台差异与兼容性说明 +- 审核、发布与上线流程 +- 性能与包体积优化 + +## 参考资源 + +- https://nativesupport.dcloud.net.cn/ diff --git a/.agents/bak-skills/uniapp-native-app/LICENSE.txt b/.agents/bak-skills/uniapp-native-app/LICENSE.txt new file mode 100644 index 0000000..b03965a --- /dev/null +++ b/.agents/bak-skills/uniapp-native-app/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 partme-ai + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/.agents/bak-skills/uniapp-native-app/SKILL.md b/.agents/bak-skills/uniapp-native-app/SKILL.md new file mode 100644 index 0000000..2629474 --- /dev/null +++ b/.agents/bak-skills/uniapp-native-app/SKILL.md @@ -0,0 +1,105 @@ +--- +name: uniapp-native-app +description: A comprehensive skill for uni-app native app offline packaging. Use this skill to package uni-app as native Android/iOS apps, configure native app settings, handle signing, and follow official offline packaging documentation. +license: Complete terms in LICENSE.txt +--- + +## When to use this skill + +Use this skill whenever the user wants to: +- Package uni-app as native Android app +- Package uni-app as native iOS app +- Configure native app settings (manifest, permissions, etc.) +- Customize native app features +- Integrate native plugins +- Configure app signing and certificates +- Handle native app build and distribution + +## How to use this skill + +To package native apps: + +1. **Identify the platform** from the user's request: + - Android → Use Android examples + - iOS → Use iOS examples + +2. **Load the appropriate example file** from the `examples/` directory: + - `examples/guide/` - Native app packaging guide + - `examples/android/` - Android packaging examples + - `examples/ios/` - iOS packaging examples + +3. **Load the appropriate template** from the `templates/` directory: + - `templates/build-config.md` - Build configuration templates + +4. **Follow the specific instructions** in those files for packaging + +## Examples and Templates + +### Examples + +Located in `examples/`: + +- **guide/** - Offline packaging overview and setup +- **android/** - Android signing, keystore, build configs +- **ios/** - iOS signing, provisioning, build configs + +### Templates + +Located in `templates/`: + +- **build-config.md** - Build configuration templates + +## Best Practices + +1. **Follow platform guidelines**: Adhere to Android and iOS development standards +2. **Optimize app size**: Minimize APK/IPA size +3. **Security**: Properly configure app signing and certificates +4. **Testing**: Test on real devices before release + +## Resources + +- **Official Documentation**: https://nativesupport.dcloud.net.cn/AppDocs/ + +## Keywords + +native app, 原生App, Android打包, iOS打包, 离线打包, app packaging, native plugin + +## 能力边界 + +### ✅ 适用场景 +- 当你需要使用此技能对应的技术栈时 +- 当项目需要遵循最佳实践时 +- 当需要快速上手或深入理解核心概念时 + +### ⚠️ 需要注意 +- 复杂业务逻辑需要结合具体场景调整 +- 性能优化需要根据实际数据量评估 + +### ❌ 不适用场景 +- 不相关的技术栈或框架 +- 需要完全自定义的特殊场景 + +## 常见陷阱 (Gotchas) + +1. **版本兼容性**:注意框架版本与依赖库的兼容性,不同版本 API 可能有差异 +2. **配置文件格式**:配置文件格式错误是最常见的问题,建议使用编辑器的语法检查 +3. **环境变量**:确保所有必要的环境变量已正确设置,敏感信息不要硬编码 +4. **依赖冲突**:多版本共存时注意依赖冲突,使用 lock 文件锁定版本 +5. **性能陷阱**:大数据量场景下注意性能优化,避免 N+1 查询等常见问题 + +## 使用流程 + +### Step 1: 环境准备 +确保开发环境已安装必要的依赖和工具。 + +### Step 2: 配置初始化 +根据项目需求进行基础配置。 + +### Step 3: 核心功能使用 +按照示例代码实现核心功能。 + +### Step 4: 测试验证 +运行测试确保功能正常。 + +### Step 5: 部署上线 +完成开发后进行部署和监控。 diff --git a/.agents/bak-skills/uniapp-native-app/examples/android/build.md b/.agents/bak-skills/uniapp-native-app/examples/android/build.md new file mode 100644 index 0000000..adfc423 --- /dev/null +++ b/.agents/bak-skills/uniapp-native-app/examples/android/build.md @@ -0,0 +1,15 @@ +# Android 打包配置 + +## 官方文档 + +参考官方文档:https://nativesupport.dcloud.net.cn/AppDocs/ + +## 配置要点 + +- 包名(applicationId) +- 版本号(versionCode/versionName) +- 权限与应用签名 + +## 参考资源 + +- https://nativesupport.dcloud.net.cn/AppDocs/ diff --git a/.agents/bak-skills/uniapp-native-app/examples/android/keystore.md b/.agents/bak-skills/uniapp-native-app/examples/android/keystore.md new file mode 100644 index 0000000..3ea3490 --- /dev/null +++ b/.agents/bak-skills/uniapp-native-app/examples/android/keystore.md @@ -0,0 +1,15 @@ +# Android Keystore 生成 + +## 官方文档 + +参考官方文档:https://nativesupport.dcloud.net.cn/AppDocs/ + +## 示例命令 + +```bash +keytool -genkeypair -alias uniapp -keyalg RSA -keysize 2048 -validity 36500 -keystore uniapp.keystore +``` + +## 参考资源 + +- https://nativesupport.dcloud.net.cn/AppDocs/ diff --git a/.agents/bak-skills/uniapp-native-app/examples/android/signing.md b/.agents/bak-skills/uniapp-native-app/examples/android/signing.md new file mode 100644 index 0000000..36289f2 --- /dev/null +++ b/.agents/bak-skills/uniapp-native-app/examples/android/signing.md @@ -0,0 +1,15 @@ +# Android 签名配置 + +## 官方文档 + +参考官方文档:https://nativesupport.dcloud.net.cn/AppDocs/ + +## 关键步骤 + +1. 生成 keystore +2. 配置包名与签名信息 +3. 打包 APK 并验证签名 + +## 参考资源 + +- https://nativesupport.dcloud.net.cn/AppDocs/ diff --git a/.agents/bak-skills/uniapp-native-app/examples/guide/intro.md b/.agents/bak-skills/uniapp-native-app/examples/guide/intro.md new file mode 100644 index 0000000..e5e9754 --- /dev/null +++ b/.agents/bak-skills/uniapp-native-app/examples/guide/intro.md @@ -0,0 +1,29 @@ +# uni-app 原生App离线打包指南 + +## 官方文档 + +参考官方文档:https://nativesupport.dcloud.net.cn/AppDocs/ + +## 什么是离线打包 + +离线打包是将 uni-app 项目打包成原生 Android 或 iOS 应用的过程。 + +## 打包流程 + +### Android 打包 + +1. 准备 Android 开发环境 +2. 配置 manifest.json +3. 使用 Android Studio 打包 +4. 签名和发布 + +### iOS 打包 + +1. 准备 iOS 开发环境 +2. 配置 manifest.json +3. 使用 Xcode 打包 +4. 签名和发布 + +## 参考资源 + +- App离线打包文档:https://nativesupport.dcloud.net.cn/AppDocs/ diff --git a/.agents/bak-skills/uniapp-native-app/examples/guide/offline-packaging.md b/.agents/bak-skills/uniapp-native-app/examples/guide/offline-packaging.md new file mode 100644 index 0000000..2dc921f --- /dev/null +++ b/.agents/bak-skills/uniapp-native-app/examples/guide/offline-packaging.md @@ -0,0 +1,21 @@ +# App 离线打包流程 + +## 官方文档 + +参考官方文档:https://nativesupport.dcloud.net.cn/AppDocs/ + +## 概述 + +- 离线打包用于生成原生 Android/iOS 安装包 +- 需配置 App 包名、证书、权限、图标等 + +## 流程要点 + +1. 准备 App 证书与包名 +2. 配置 manifest.json +3. 构建离线资源包 +4. 使用离线打包工具生成 APK/IPA + +## 参考资源 + +- https://nativesupport.dcloud.net.cn/AppDocs/ diff --git a/.agents/bak-skills/uniapp-native-app/examples/ios/provisioning.md b/.agents/bak-skills/uniapp-native-app/examples/ios/provisioning.md new file mode 100644 index 0000000..c33f6a1 --- /dev/null +++ b/.agents/bak-skills/uniapp-native-app/examples/ios/provisioning.md @@ -0,0 +1,14 @@ +# iOS 描述文件配置 + +## 官方文档 + +参考官方文档:https://nativesupport.dcloud.net.cn/AppDocs/ + +## 说明 + +- 生成并下载 Provisioning Profile +- 在打包工具中选择证书与描述文件 + +## 参考资源 + +- https://nativesupport.dcloud.net.cn/AppDocs/ diff --git a/.agents/bak-skills/uniapp-native-app/examples/ios/signing.md b/.agents/bak-skills/uniapp-native-app/examples/ios/signing.md new file mode 100644 index 0000000..fcf7469 --- /dev/null +++ b/.agents/bak-skills/uniapp-native-app/examples/ios/signing.md @@ -0,0 +1,15 @@ +# iOS 签名配置 + +## 官方文档 + +参考官方文档:https://nativesupport.dcloud.net.cn/AppDocs/ + +## 关键步骤 + +- 创建 App ID +- 配置证书与描述文件 +- 使用证书打包 IPA + +## 参考资源 + +- https://nativesupport.dcloud.net.cn/AppDocs/ diff --git a/.agents/bak-skills/uniapp-native-app/templates/build-config.md b/.agents/bak-skills/uniapp-native-app/templates/build-config.md new file mode 100644 index 0000000..c3d6936 --- /dev/null +++ b/.agents/bak-skills/uniapp-native-app/templates/build-config.md @@ -0,0 +1,18 @@ +# 离线打包配置模板 + +## 官方文档 + +参考官方文档:https://nativesupport.dcloud.net.cn/AppDocs/ + +## 配置清单 + +- 应用名称 +- 包名(AppID) +- 版本号与构建号 +- 图标与启动图 +- 权限与能力 +- 证书与签名配置 + +## 参考资源 + +- https://nativesupport.dcloud.net.cn/AppDocs/ diff --git a/.agents/bak-skills/uniapp-native-plugin/LICENSE.txt b/.agents/bak-skills/uniapp-native-plugin/LICENSE.txt new file mode 100644 index 0000000..b03965a --- /dev/null +++ b/.agents/bak-skills/uniapp-native-plugin/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 partme-ai + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/.agents/bak-skills/uniapp-native-plugin/SKILL.md b/.agents/bak-skills/uniapp-native-plugin/SKILL.md new file mode 100644 index 0000000..9122f52 --- /dev/null +++ b/.agents/bak-skills/uniapp-native-plugin/SKILL.md @@ -0,0 +1,105 @@ +--- +name: uniapp-native-plugin +description: A comprehensive skill for developing native plugins for uni-app. Use this skill when building Android/iOS native plugins, integrating native capabilities, or publishing plugins based on official native plugin docs. +license: Complete terms in LICENSE.txt +--- + +## When to use this skill + +Use this skill whenever the user wants to: +- Develop native Android plugins +- Develop native iOS plugins +- Integrate native functionality into uni-app +- Create custom native modules +- Extend uni-app with native capabilities +- Handle native plugin communication +- Package and distribute native plugins + +## How to use this skill + +To develop native plugins: + +1. **Identify the platform** from the user's request: + - Android → Use Android plugin examples + - iOS → Use iOS plugin examples + +2. **Load the appropriate example file** from the `examples/` directory: + - `examples/guide/` - Native plugin development guide + - `examples/android-plugin/` - Android plugin examples + - `examples/ios-plugin/` - iOS plugin examples + +3. **Load the appropriate template** from the `templates/` directory: + - `templates/plugin-template.md` - Plugin development templates + +4. **Follow the specific instructions** in those files for development + +## Examples and Templates + +### Examples + +Located in `examples/`: + +- **guide/** - Native plugin development guide +- **android-plugin/** - Android plugin development examples +- **ios-plugin/** - iOS plugin development examples + +### Templates + +Located in `templates/`: + +- **plugin-template.md** - Plugin development templates + +## Best Practices + +1. **Follow platform guidelines**: Adhere to Android and iOS development standards +2. **Error handling**: Implement proper error handling and logging +3. **Documentation**: Provide clear documentation for plugin usage +4. **Testing**: Test plugins thoroughly on real devices + +## Resources + +- **Official Documentation**: https://nativesupport.dcloud.net.cn/NativePlugin/ + +## Keywords + +native plugin, 原生插件, Android插件, iOS插件, plugin development, native module + +## 能力边界 + +### ✅ 适用场景 +- 当你需要使用此技能对应的技术栈时 +- 当项目需要遵循最佳实践时 +- 当需要快速上手或深入理解核心概念时 + +### ⚠️ 需要注意 +- 复杂业务逻辑需要结合具体场景调整 +- 性能优化需要根据实际数据量评估 + +### ❌ 不适用场景 +- 不相关的技术栈或框架 +- 需要完全自定义的特殊场景 + +## 常见陷阱 (Gotchas) + +1. **版本兼容性**:注意框架版本与依赖库的兼容性,不同版本 API 可能有差异 +2. **配置文件格式**:配置文件格式错误是最常见的问题,建议使用编辑器的语法检查 +3. **环境变量**:确保所有必要的环境变量已正确设置,敏感信息不要硬编码 +4. **依赖冲突**:多版本共存时注意依赖冲突,使用 lock 文件锁定版本 +5. **性能陷阱**:大数据量场景下注意性能优化,避免 N+1 查询等常见问题 + +## 使用流程 + +### Step 1: 环境准备 +确保开发环境已安装必要的依赖和工具。 + +### Step 2: 配置初始化 +根据项目需求进行基础配置。 + +### Step 3: 核心功能使用 +按照示例代码实现核心功能。 + +### Step 4: 测试验证 +运行测试确保功能正常。 + +### Step 5: 部署上线 +完成开发后进行部署和监控。 diff --git a/.agents/bak-skills/uniapp-native-plugin/examples/android-plugin/native-api.md b/.agents/bak-skills/uniapp-native-plugin/examples/android-plugin/native-api.md new file mode 100644 index 0000000..0750b87 --- /dev/null +++ b/.agents/bak-skills/uniapp-native-plugin/examples/android-plugin/native-api.md @@ -0,0 +1,14 @@ +# Android 原生能力封装 + +## 官方文档 + +参考官方文档:https://nativesupport.dcloud.net.cn/NativePlugin/ + +## 示例 + +- 封装系统能力(定位、蓝牙、推送等) +- 暴露 JS 调用接口 + +## 参考资源 + +- https://nativesupport.dcloud.net.cn/NativePlugin/ diff --git a/.agents/bak-skills/uniapp-native-plugin/examples/android-plugin/project-setup.md b/.agents/bak-skills/uniapp-native-plugin/examples/android-plugin/project-setup.md new file mode 100644 index 0000000..e4774fd --- /dev/null +++ b/.agents/bak-skills/uniapp-native-plugin/examples/android-plugin/project-setup.md @@ -0,0 +1,15 @@ +# Android 插件工程初始化 + +## 官方文档 + +参考官方文档:https://nativesupport.dcloud.net.cn/NativePlugin/ + +## 步骤 + +1. 创建 Android 原生模块 +2. 接入 uni-app 插件接口 +3. 编写插件入口与配置 + +## 参考资源 + +- https://nativesupport.dcloud.net.cn/NativePlugin/ diff --git a/.agents/bak-skills/uniapp-native-plugin/examples/guide/bridge.md b/.agents/bak-skills/uniapp-native-plugin/examples/guide/bridge.md new file mode 100644 index 0000000..6b477aa --- /dev/null +++ b/.agents/bak-skills/uniapp-native-plugin/examples/guide/bridge.md @@ -0,0 +1,14 @@ +# JS Bridge 通信 + +## 官方文档 + +参考官方文档:https://nativesupport.dcloud.net.cn/NativePlugin/ + +## 说明 + +- 使用 JSBridge 在 JS 与原生层之间通信 +- 设计统一的接口规范与参数结构 + +## 参考资源 + +- https://nativesupport.dcloud.net.cn/NativePlugin/ diff --git a/.agents/bak-skills/uniapp-native-plugin/examples/guide/intro.md b/.agents/bak-skills/uniapp-native-plugin/examples/guide/intro.md new file mode 100644 index 0000000..af15808 --- /dev/null +++ b/.agents/bak-skills/uniapp-native-plugin/examples/guide/intro.md @@ -0,0 +1,31 @@ +# uni-app 原生插件开发指南 + +## 官方文档 + +参考官方文档:https://nativesupport.dcloud.net.cn/NativePlugin/ + +## 什么是原生插件 + +原生插件是用原生代码(Android Java/Kotlin 或 iOS Objective-C/Swift)开发的插件,可以扩展 uni-app 的功能。 + +## 开发流程 + +### Android 插件 + +1. 创建 Android 插件项目 +2. 实现插件功能 +3. 配置插件信息 +4. 打包插件 +5. 集成到 uni-app 项目 + +### iOS 插件 + +1. 创建 iOS 插件项目 +2. 实现插件功能 +3. 配置插件信息 +4. 打包插件 +5. 集成到 uni-app 项目 + +## 参考资源 + +- 原生插件开发文档:https://nativesupport.dcloud.net.cn/NativePlugin/ diff --git a/.agents/bak-skills/uniapp-native-plugin/examples/guide/structure.md b/.agents/bak-skills/uniapp-native-plugin/examples/guide/structure.md new file mode 100644 index 0000000..0f45f24 --- /dev/null +++ b/.agents/bak-skills/uniapp-native-plugin/examples/guide/structure.md @@ -0,0 +1,20 @@ +# 原生插件结构与发布 + +## 官方文档 + +参考官方文档:https://nativesupport.dcloud.net.cn/NativePlugin/ + +## 目录结构 + +- plugin 代码 +- JS Bridge 接口 +- 配置与说明文档 + +## 发布要点 + +- 完善插件描述与使用说明 +- 提供平台支持与版本兼容说明 + +## 参考资源 + +- https://nativesupport.dcloud.net.cn/NativePlugin/ diff --git a/.agents/bak-skills/uniapp-native-plugin/examples/ios-plugin/native-api.md b/.agents/bak-skills/uniapp-native-plugin/examples/ios-plugin/native-api.md new file mode 100644 index 0000000..5174c5f --- /dev/null +++ b/.agents/bak-skills/uniapp-native-plugin/examples/ios-plugin/native-api.md @@ -0,0 +1,14 @@ +# iOS 原生能力封装 + +## 官方文档 + +参考官方文档:https://nativesupport.dcloud.net.cn/NativePlugin/ + +## 示例 + +- 封装系统能力(摄像头、文件、推送等) +- 暴露 JS 调用接口 + +## 参考资源 + +- https://nativesupport.dcloud.net.cn/NativePlugin/ diff --git a/.agents/bak-skills/uniapp-native-plugin/examples/ios-plugin/project-setup.md b/.agents/bak-skills/uniapp-native-plugin/examples/ios-plugin/project-setup.md new file mode 100644 index 0000000..47e4ae2 --- /dev/null +++ b/.agents/bak-skills/uniapp-native-plugin/examples/ios-plugin/project-setup.md @@ -0,0 +1,15 @@ +# iOS 插件工程初始化 + +## 官方文档 + +参考官方文档:https://nativesupport.dcloud.net.cn/NativePlugin/ + +## 步骤 + +1. 创建 iOS 原生模块 +2. 接入 uni-app 插件接口 +3. 编写插件入口与配置 + +## 参考资源 + +- https://nativesupport.dcloud.net.cn/NativePlugin/ diff --git a/.agents/bak-skills/uniapp-native-plugin/templates/plugin-template.md b/.agents/bak-skills/uniapp-native-plugin/templates/plugin-template.md new file mode 100644 index 0000000..f29790e --- /dev/null +++ b/.agents/bak-skills/uniapp-native-plugin/templates/plugin-template.md @@ -0,0 +1,15 @@ +# 原生插件模板 + +## 官方文档 + +参考官方文档:https://nativesupport.dcloud.net.cn/NativePlugin/ + +## 模板清单 + +- 插件描述与版本信息 +- JS 接口定义 +- Android/iOS 实现说明 + +## 参考资源 + +- https://nativesupport.dcloud.net.cn/NativePlugin/ diff --git a/.agents/bak-skills/uniapp-plugin/LICENSE.txt b/.agents/bak-skills/uniapp-plugin/LICENSE.txt new file mode 100644 index 0000000..b03965a --- /dev/null +++ b/.agents/bak-skills/uniapp-plugin/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 partme-ai + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/.agents/bak-skills/uniapp-plugin/SKILL.md b/.agents/bak-skills/uniapp-plugin/SKILL.md new file mode 100644 index 0000000..a37bc3c --- /dev/null +++ b/.agents/bak-skills/uniapp-plugin/SKILL.md @@ -0,0 +1,108 @@ +--- +name: uniapp-plugin +description: A comprehensive skill for the uni-app plugin market and automatic plugin installation. Use this skill to browse plugins, auto-install plugins, configure plugin settings, and integrate third-party plugins based on the official plugin market docs. +license: Complete terms in LICENSE.txt +--- + +## When to use this skill + +Use this skill whenever the user wants to: +- Use plugins from the uni-app plugin market +- Automatically install plugins into projects +- Configure plugin settings +- Integrate third-party plugins +- Handle plugin dependencies +- Update and manage plugins +- Work with different plugin types (components, APIs, templates, etc.) + +## How to use this skill + +To use plugins: + +1. **Identify the plugin type** from the user's request: + - Component plugins → Use component plugin examples + - API plugins → Use API plugin examples + - Template plugins → Use template plugin examples + +2. **Load the appropriate example file** from the `examples/` directory: + - `examples/guide/` - Plugin usage guide + - `examples/plugin-types/` - Different plugin type examples + - `examples/installation/` - Plugin installation methods + +3. **Load the appropriate template** from the `templates/` directory: + - `templates/plugin-usage.md` - Plugin usage templates + +4. **Follow the specific instructions** in those files for plugin integration + +## Examples and Templates + +### Examples + +Located in `examples/`: + +- **guide/** - Plugin usage guide and best practices +- **plugin-types/** - Different plugin type examples +- **installation/** - Plugin installation methods and examples + +### Templates + +Located in `templates/`: + +- **plugin-usage.md** - Plugin usage templates and examples + +## Best Practices + +1. **Choose reliable plugins**: Use plugins from trusted sources +2. **Check compatibility**: Ensure plugin compatibility with your uni-app version +3. **Read documentation**: Always read plugin documentation before use +4. **Update regularly**: Keep plugins updated to latest versions +5. **Handle dependencies**: Manage plugin dependencies properly + +## Resources + +- **Plugin Market**: https://ext.dcloud.net.cn/ +- **Official Documentation**: https://uniapp.dcloud.net.cn/plugin/ + +## Keywords + +plugin market, 插件市场, uni-app plugin, 插件安装, plugin integration, 插件使用 + +## 能力边界 + +### ✅ 适用场景 +- 当你需要使用此技能对应的技术栈时 +- 当项目需要遵循最佳实践时 +- 当需要快速上手或深入理解核心概念时 + +### ⚠️ 需要注意 +- 复杂业务逻辑需要结合具体场景调整 +- 性能优化需要根据实际数据量评估 + +### ❌ 不适用场景 +- 不相关的技术栈或框架 +- 需要完全自定义的特殊场景 + +## 常见陷阱 (Gotchas) + +1. **版本兼容性**:注意框架版本与依赖库的兼容性,不同版本 API 可能有差异 +2. **配置文件格式**:配置文件格式错误是最常见的问题,建议使用编辑器的语法检查 +3. **环境变量**:确保所有必要的环境变量已正确设置,敏感信息不要硬编码 +4. **依赖冲突**:多版本共存时注意依赖冲突,使用 lock 文件锁定版本 +5. **性能陷阱**:大数据量场景下注意性能优化,避免 N+1 查询等常见问题 + +## 使用流程 + +### Step 1: 环境准备 +确保开发环境已安装必要的依赖和工具。 + +### Step 2: 配置初始化 +根据项目需求进行基础配置。 + +### Step 3: 核心功能使用 +按照示例代码实现核心功能。 + +### Step 4: 测试验证 +运行测试确保功能正常。 + +### Step 5: 部署上线 +完成开发后进行部署和监控。 diff --git a/.agents/bak-skills/uniapp-plugin/examples/guide/intro.md b/.agents/bak-skills/uniapp-plugin/examples/guide/intro.md new file mode 100644 index 0000000..59d4832 --- /dev/null +++ b/.agents/bak-skills/uniapp-plugin/examples/guide/intro.md @@ -0,0 +1,14 @@ +# 插件市场使用概览 + +## 官方文档 + +参考官方文档:https://ext.dcloud.net.cn/ + +## 适用场景 + +- 从插件市场集成组件或能力 +- 在项目中自动安装与管理插件 + +## 参考资源 + +- https://ext.dcloud.net.cn/ diff --git a/.agents/bak-skills/uniapp-plugin/examples/installation/hbuilderx.md b/.agents/bak-skills/uniapp-plugin/examples/installation/hbuilderx.md new file mode 100644 index 0000000..a9a45c4 --- /dev/null +++ b/.agents/bak-skills/uniapp-plugin/examples/installation/hbuilderx.md @@ -0,0 +1,15 @@ +# HBuilderX 安装插件 + +## 官方文档 + +参考官方文档:https://ext.dcloud.net.cn/ + +## 步骤 + +1. HBuilderX 菜单 → 工具 → 插件安装 +2. 搜索插件名称或 ID +3. 选择安装并导入项目 + +## 参考资源 + +- https://ext.dcloud.net.cn/ diff --git a/.agents/bak-skills/uniapp-plugin/examples/installation/marketplace.md b/.agents/bak-skills/uniapp-plugin/examples/installation/marketplace.md new file mode 100644 index 0000000..93820a0 --- /dev/null +++ b/.agents/bak-skills/uniapp-plugin/examples/installation/marketplace.md @@ -0,0 +1,15 @@ +# 插件市场安装 + +## 官方文档 + +参考官方文档:https://ext.dcloud.net.cn/ + +## 步骤 + +1. 打开插件市场并选择插件 +2. 点击“使用 HBuilderX 导入” +3. 在项目中完成插件依赖配置 + +## 参考资源 + +- https://ext.dcloud.net.cn/ diff --git a/.agents/bak-skills/uniapp-plugin/examples/plugin-types/api.md b/.agents/bak-skills/uniapp-plugin/examples/plugin-types/api.md new file mode 100644 index 0000000..51e59c3 --- /dev/null +++ b/.agents/bak-skills/uniapp-plugin/examples/plugin-types/api.md @@ -0,0 +1,14 @@ +# API 类插件 + +## 官方文档 + +参考官方文档:https://ext.dcloud.net.cn/ + +## 说明 + +- API 类插件扩展系统能力 +- 需关注平台兼容性与权限配置 + +## 参考资源 + +- https://ext.dcloud.net.cn/ diff --git a/.agents/bak-skills/uniapp-plugin/examples/plugin-types/component.md b/.agents/bak-skills/uniapp-plugin/examples/plugin-types/component.md new file mode 100644 index 0000000..3dae689 --- /dev/null +++ b/.agents/bak-skills/uniapp-plugin/examples/plugin-types/component.md @@ -0,0 +1,14 @@ +# 组件类插件 + +## 官方文档 + +参考官方文档:https://ext.dcloud.net.cn/ + +## 说明 + +- 组件类插件提供 UI 组件或页面模板 +- 通常以 uni_modules 形式接入 + +## 参考资源 + +- https://ext.dcloud.net.cn/ diff --git a/.agents/bak-skills/uniapp-plugin/examples/plugin-types/template.md b/.agents/bak-skills/uniapp-plugin/examples/plugin-types/template.md new file mode 100644 index 0000000..5be1b78 --- /dev/null +++ b/.agents/bak-skills/uniapp-plugin/examples/plugin-types/template.md @@ -0,0 +1,14 @@ +# 模板类插件 + +## 官方文档 + +参考官方文档:https://ext.dcloud.net.cn/ + +## 说明 + +- 模板类插件提供项目模板或页面模板 +- 用于快速创建项目或功能模块 + +## 参考资源 + +- https://ext.dcloud.net.cn/ diff --git a/.agents/bak-skills/uniapp-plugin/templates/plugin-usage.md b/.agents/bak-skills/uniapp-plugin/templates/plugin-usage.md new file mode 100644 index 0000000..ba1f1ee --- /dev/null +++ b/.agents/bak-skills/uniapp-plugin/templates/plugin-usage.md @@ -0,0 +1,16 @@ +# 插件使用模板 + +## 官方文档 + +参考官方文档:https://ext.dcloud.net.cn/ + +## 使用清单 + +- 插件安装方式 +- 依赖与版本兼容 +- 初始化与配置步骤 +- 典型使用示例 + +## 参考资源 + +- https://ext.dcloud.net.cn/ diff --git a/.agents/bak-skills/uniapp-project-creator/SKILL.md b/.agents/bak-skills/uniapp-project-creator/SKILL.md new file mode 100644 index 0000000..7a38c25 --- /dev/null +++ b/.agents/bak-skills/uniapp-project-creator/SKILL.md @@ -0,0 +1,123 @@ +--- +name: uniapp-project-creator +description: Provides one-command project creation for uni-app using the official quickstart CLI, including project initialization, configuration, and template selection. Use when the user asks to create a uni-app project with a single command, needs to initialize a new uni-app project, or generate uni-app project structure. +license: Complete terms in LICENSE.txt +--- + +## When to use this skill + +Use this skill whenever the user wants to: +- Create a new uni-app project from scratch +- Initialize uni-app project structure and configuration files +- Set up development environment for uni-app +- Generate project templates with different configurations +- Configure manifest.json and pages.json files +- Create uni-app pages and components +- Set up uni-app project with HBuilderX or CLI + +## How to use this skill + +To create a uni-app project with a single command or via HBuilderX: + +1. **Identify the project type** from the user's request: + - Standard uni-app project → Use Vue 2 or Vue 3 template + - HBuilderX project → Use HBuilderX creation method + - CLI project → Use Vue CLI or official CLI commands + +2. **Load the appropriate example file** from the `examples/guide/` directory: + - `examples/guide/installation.md` - Installation and environment setup + - `examples/guide/quick-start.md` - Quick start guide + - `examples/guide/project-types.md` - Different project types and templates + +3. **Load the appropriate template file** from the `templates/` directory: + - `templates/project-templates.md` - Project structure templates + - `templates/cli-commands.md` - CLI command templates + +4. **Follow the specific instructions** in those files for project creation, structure, and configuration + +5. **Generate the project structure** with proper files and configurations + +**Important Notes**: +- This skill focuses on uni-app CLI quickstart and HBuilderX creation flows +- Use one command creation when the user wants "一句话创建" +- Ensure Vue 2/Vue 3 template choice matches the user's target stack + +## Examples and Templates + +### Examples + +Located in `examples/guide/`: + +- **installation.md** - Installation guide for uni-app development environment +- **quick-start.md** - Quick start guide for creating first uni-app project +- **project-types.md** - Different project types (Vue 2, Vue 3, TypeScript, etc.) + +### Templates + +Located in `templates/`: + +- **project-templates.md** - Complete project structure templates +- **cli-commands.md** - CLI command templates for project creation + +## API Reference + +This skill focuses on project creation and initialization. For component and API references, see `uniapp-project-guide`. + +## Best Practices + +1. **Choose the right template**: Select Vue 2 or Vue 3 based on project requirements +2. **Configure properly**: Set up manifest.json and pages.json correctly +3. **Organize structure**: Follow standard uni-app directory structure +4. **Use CLI when possible**: CLI provides more flexibility than HBuilderX +5. **Version control**: Initialize git repository after project creation + +## Resources + +- **Official Documentation**: https://uniapp.dcloud.net.cn/quickstart-cli.html +- **HBuilderX**: https://www.dcloud.io/hbuilderx.html +- **Vue CLI**: https://cli.vuejs.org/ +- **uni-app GitHub**: https://github.com/dcloudio/uni-app + +## Keywords + +uniapp, uni-app, project creator, project initialization, HBuilderX, Vue CLI, manifest.json, pages.json, uni-app setup, uni-app template, 创建项目, 项目初始化, 快速开始 + +## 能力边界 + +### ✅ 适用场景 +- 当你需要使用此技能对应的技术栈时 +- 当项目需要遵循最佳实践时 +- 当需要快速上手或深入理解核心概念时 + +### ⚠️ 需要注意 +- 复杂业务逻辑需要结合具体场景调整 +- 性能优化需要根据实际数据量评估 + +### ❌ 不适用场景 +- 不相关的技术栈或框架 +- 需要完全自定义的特殊场景 + +## 常见陷阱 (Gotchas) + +1. **版本兼容性**:注意框架版本与依赖库的兼容性,不同版本 API 可能有差异 +2. **配置文件格式**:配置文件格式错误是最常见的问题,建议使用编辑器的语法检查 +3. **环境变量**:确保所有必要的环境变量已正确设置,敏感信息不要硬编码 +4. **依赖冲突**:多版本共存时注意依赖冲突,使用 lock 文件锁定版本 +5. **性能陷阱**:大数据量场景下注意性能优化,避免 N+1 查询等常见问题 + +## 使用流程 + +### Step 1: 环境准备 +确保开发环境已安装必要的依赖和工具。 + +### Step 2: 配置初始化 +根据项目需求进行基础配置。 + +### Step 3: 核心功能使用 +按照示例代码实现核心功能。 + +### Step 4: 测试验证 +运行测试确保功能正常。 + +### Step 5: 部署上线 +完成开发后进行部署和监控。 diff --git a/.agents/bak-skills/uniapp-project-creator/examples/guide/installation.md b/.agents/bak-skills/uniapp-project-creator/examples/guide/installation.md new file mode 100644 index 0000000..ce34af2 --- /dev/null +++ b/.agents/bak-skills/uniapp-project-creator/examples/guide/installation.md @@ -0,0 +1,119 @@ +# uni-app 安装指南 + +## 官方文档 + +参考官方文档:https://uniapp.dcloud.net.cn/quickstart-cli.html + +## 安装方式 + +### 方式一:使用 HBuilderX(推荐新手) + +HBuilderX 是 DCloud 官方提供的 IDE,内置 uni-app 开发环境。 + +**下载安装**: +1. 访问 https://www.dcloud.io/hbuilderx.html +2. 下载 HBuilderX(标准版或 App 开发版) +3. 安装并启动 HBuilderX + +**创建项目**: +1. 文件 → 新建 → 项目 +2. 选择 uni-app +3. 选择模板(默认模板、uni-ui 项目模板等) +4. 填写项目名称和路径 +5. 点击创建 + +### 方式二:使用 Vue CLI(推荐有经验开发者) + +**安装 Vue CLI**: + +```bash +# 全局安装 Vue CLI +npm install -g @vue/cli + +# 检查版本 +vue --version +``` + +**创建 uni-app 项目**: + +```bash +# 使用官方预设模板 +vue create -p dcloudio/uni-preset-vue my-project + +# 或使用 degit(更快) +npx degit dcloudio/uni-preset-vue my-project +``` + +**选择 Vue 版本**: +- Vue 2:稳定版本,兼容性好 +- Vue 3:最新版本,性能更好 + +### 方式三:使用官方 CLI(uni-app CLI) + +```bash +# 安装 uni-app CLI +npm install -g @dcloudio/uvm +uvm + +# 创建项目 +npx degit dcloudio/uni-preset-vue my-project +``` + +## 环境要求 + +### Node.js 版本 + +- **推荐版本**:Node.js 14.x 或更高版本 +- **最低版本**:Node.js 12.x + +```bash +# 检查 Node.js 版本 +node --version + +# 检查 npm 版本 +npm --version +``` + +### 其他工具 + +- **微信开发者工具**:用于开发微信小程序 +- **Android Studio**:用于开发 Android App +- **Xcode**:用于开发 iOS App(仅 macOS) + +## 验证安装 + +创建项目后,验证安装是否成功: + +```bash +cd my-project +npm install +npm run dev:h5 +``` + +如果浏览器自动打开并显示 uni-app 欢迎页面,说明安装成功。 + +## 常见问题 + +### 1. npm 安装慢 + +使用国内镜像: + +```bash +npm config set registry https://registry.npmmirror.com +``` + +### 2. Vue CLI 版本问题 + +确保使用最新版本: + +```bash +npm update -g @vue/cli +``` + +### 3. HBuilderX 无法创建项目 + +检查 HBuilderX 版本,确保是最新版本。 + +## 下一步 + +安装完成后,参考 `quick-start.md` 开始创建第一个项目。 diff --git a/.agents/bak-skills/uniapp-project-creator/examples/guide/project-types.md b/.agents/bak-skills/uniapp-project-creator/examples/guide/project-types.md new file mode 100644 index 0000000..97f2d48 --- /dev/null +++ b/.agents/bak-skills/uniapp-project-creator/examples/guide/project-types.md @@ -0,0 +1,216 @@ +# uni-app 项目类型 + +## 官方文档 + +参考官方文档:https://uniapp.dcloud.net.cn/quickstart-cli.html + +## 项目类型 + +### 1. Vue 2 项目 + +**特点**: +- 使用 Vue 2.x +- 使用 Options API +- 稳定成熟,兼容性好 + +**创建方式**: + +```bash +# 使用 Vue CLI +vue create -p dcloudio/uni-preset-vue my-vue2-project + +# 选择 Vue 2 +``` + +**适用场景**: +- 需要兼容旧版本 Vue 的项目 +- 团队熟悉 Vue 2 语法 +- 需要稳定性的项目 + +### 2. Vue 3 项目 + +**特点**: +- 使用 Vue 3.x +- 支持 Composition API 和 Options API +- 性能更好,包体积更小 + +**创建方式**: + +```bash +# 使用 Vue CLI +vue create -p dcloudio/uni-preset-vue my-vue3-project + +# 选择 Vue 3 +``` + +**适用场景**: +- 新项目推荐使用 +- 需要更好的性能 +- 需要使用 Composition API + +### 3. TypeScript 项目 + +**特点**: +- 使用 TypeScript +- 类型安全 +- 更好的代码提示 + +**创建方式**: + +```bash +# 使用 Vue CLI,选择 TypeScript +vue create -p dcloudio/uni-preset-vue my-ts-project + +# 选择 TypeScript +``` + +**项目结构**: + +``` +my-ts-project/ +├── src/ +│ ├── pages/ +│ ├── components/ +│ ├── App.vue +│ └── main.ts # TypeScript 入口文件 +├── tsconfig.json # TypeScript 配置 +└── ... +``` + +**适用场景**: +- 大型项目 +- 需要类型安全 +- 团队使用 TypeScript + +### 4. uni-ui 项目模板 + +**特点**: +- 预装 uni-ui 组件库 +- 包含常用组件示例 +- 快速开发 + +**创建方式**: + +在 HBuilderX 中: +1. 文件 → 新建 → 项目 +2. 选择 uni-ui 项目模板 + +**适用场景**: +- 需要快速开发 UI +- 使用 uni-ui 组件库 +- 需要组件示例 + +### 5. 空项目模板 + +**特点**: +- 最基础的项目结构 +- 不包含示例代码 +- 完全自定义 + +**创建方式**: + +```bash +# 使用 degit +npx degit dcloudio/uni-preset-vue#empty my-empty-project +``` + +**适用场景**: +- 需要完全自定义 +- 从零开始开发 +- 学习项目结构 + +## 模板选择建议 + +### 新手推荐 + +1. **HBuilderX + 默认模板**:最简单,适合学习 +2. **Vue 2 项目**:语法简单,文档丰富 + +### 有经验开发者推荐 + +1. **Vue 3 + TypeScript**:现代化,性能好 +2. **Vue CLI 创建**:更灵活,可定制 + +### 企业项目推荐 + +1. **Vue 3 + TypeScript**:类型安全,可维护性好 +2. **uni-ui 模板**:快速开发,组件丰富 + +## 项目配置 + +### manifest.json 配置 + +不同项目类型的基本配置相同,但可以根据需要调整: + +```json +{ + "name": "my-app", + "appid": "", + "description": "", + "versionName": "1.0.0", + "versionCode": "100", + "transformPx": false, + "app-plus": { + "usingComponents": true + }, + "h5": { + "router": { + "mode": "hash" + } + }, + "mp-weixin": { + "appid": "", + "setting": { + "urlCheck": false + } + } +} +``` + +### pages.json 配置 + +所有项目类型的 pages.json 结构相同: + +```json +{ + "pages": [ + { + "path": "pages/index/index", + "style": { + "navigationBarTitleText": "首页" + } + } + ], + "globalStyle": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "uni-app", + "navigationBarBackgroundColor": "#F8F8F8", + "backgroundColor": "#F8F8F8" + } +} +``` + +## 迁移指南 + +### Vue 2 升级到 Vue 3 + +参考官方迁移指南:https://v3-migration.vuejs.org/ + +主要变化: +- 使用 Composition API +- 生命周期钩子变化 +- 响应式 API 变化 + +### JavaScript 迁移到 TypeScript + +1. 安装 TypeScript 依赖 +2. 添加 `tsconfig.json` +3. 将 `.js` 文件改为 `.ts` +4. 添加类型定义 + +## 参考资源 + +- Vue 2 文档:https://v2.cn.vuejs.org/ +- Vue 3 文档:https://cn.vuejs.org/ +- TypeScript 文档:https://www.typescriptlang.org/ +- uni-app 文档:https://uniapp.dcloud.net.cn/ diff --git a/.agents/bak-skills/uniapp-project-creator/examples/guide/quick-start.md b/.agents/bak-skills/uniapp-project-creator/examples/guide/quick-start.md new file mode 100644 index 0000000..1f03f57 --- /dev/null +++ b/.agents/bak-skills/uniapp-project-creator/examples/guide/quick-start.md @@ -0,0 +1,272 @@ +# uni-app 快速开始 + +## 官方文档 + +参考官方文档:https://uniapp.dcloud.net.cn/quickstart-cli.html + +## 创建第一个项目 + +### 一句话创建(CLI) + +```bash +# Vue 2 项目 +npx degit dcloudio/uni-preset-vue my-uniapp + +# Vue 3 + Vite 项目 +npx degit dcloudio/uni-preset-vue#vite-ts my-uniapp +``` + +### 使用 HBuilderX + +1. **打开 HBuilderX** +2. **文件 → 新建 → 项目** +3. **选择项目类型**: + - uni-app + - 选择模板(默认模板、uni-ui 项目模板等) +4. **填写项目信息**: + - 项目名称:my-first-uniapp + - 项目路径:选择保存位置 +5. **点击创建** + +### 使用 Vue CLI + +```bash +# 创建项目 +vue create -p dcloudio/uni-preset-vue my-first-uniapp + +# 进入项目目录 +cd my-first-uniapp + +# 安装依赖 +npm install + +# 运行到 H5 +npm run dev:h5 + +# 运行到微信小程序 +npm run dev:mp-weixin +``` + +### 使用官方 CLI + +```bash +# 使用 degit 创建项目 +npx degit dcloudio/uni-preset-vue my-first-uniapp + +# 进入项目目录 +cd my-first-uniapp + +# 安装依赖 +npm install + +# 运行项目 +npm run dev:h5 +``` + +## 项目结构 + +创建后的项目结构: + +``` +my-first-uniapp/ +├── pages/ # 页面目录 +│ ├── index/ +│ │ └── index.vue # 首页 +│ └── ... +├── components/ # 组件目录 +├── static/ # 静态资源 +├── uni_modules/ # uni_modules 插件 +├── App.vue # 应用入口 +├── main.js # 入口文件 +├── manifest.json # 应用配置 +├── pages.json # 页面路由配置 +└── uni.scss # 全局样式 +``` + +## 运行项目 + +### H5 平台 + +```bash +npm run dev:h5 +``` + +浏览器会自动打开 `http://localhost:8080` + +### 微信小程序 + +```bash +npm run dev:mp-weixin +``` + +项目会编译到 `dist/dev/mp-weixin`,使用微信开发者工具打开该目录。 + +### App 平台 + +```bash +# 使用 HBuilderX 运行 +# 或使用 CLI +npm run dev:app-plus +``` + +## 创建第一个页面 + +1. **在 `pages` 目录下创建页面文件夹**: + +``` +pages/ +└── hello/ + └── hello.vue +``` + +2. **创建页面文件 `hello.vue`**: + +```vue + + + + + +``` + +3. **在 `pages.json` 中注册页面**: + +```json +{ + "pages": [ + { + "path": "pages/index/index", + "style": { + "navigationBarTitleText": "首页" + } + }, + { + "path": "pages/hello/hello", + "style": { + "navigationBarTitleText": "Hello" + } + } + ] +} +``` + +4. **页面跳转**: + +```javascript +// 在 index.vue 中 +uni.navigateTo({ + url: '/pages/hello/hello' +}) +``` + +## 创建第一个组件 + +1. **在 `components` 目录下创建组件**: + +``` +components/ +└── my-button/ + └── my-button.vue +``` + +2. **组件代码**: + +```vue + + + + + +``` + +3. **在页面中使用**: + +```vue + + + +``` + +## 下一步 + +- 学习 uni-app 组件:参考 `uniapp-project` +- 学习 uni-app API:参考 `uniapp-project` +- 配置项目:参考 `templates/project-templates.md` diff --git a/.agents/bak-skills/uniapp-project-creator/templates/cli-commands.md b/.agents/bak-skills/uniapp-project-creator/templates/cli-commands.md new file mode 100644 index 0000000..007a109 --- /dev/null +++ b/.agents/bak-skills/uniapp-project-creator/templates/cli-commands.md @@ -0,0 +1,294 @@ +# uni-app CLI 命令模板 + +## 官方文档 + +参考官方文档:https://uniapp.dcloud.net.cn/quickstart-cli.html + +## 项目创建命令 + +### 使用 Vue CLI + +```bash +# 安装 Vue CLI(如果未安装) +npm install -g @vue/cli + +# 创建 uni-app 项目 +vue create -p dcloudio/uni-preset-vue my-project + +# 选择 Vue 版本 +# - Vue 2 +# - Vue 3 +``` + +### 使用 degit(推荐,更快) + +```bash +# 创建 Vue 2 项目 +npx degit dcloudio/uni-preset-vue my-project + +# 创建 Vue 3 项目 +npx degit dcloudio/uni-preset-vue#vite-ts my-project + +# 创建空项目 +npx degit dcloudio/uni-preset-vue#empty my-project +``` + +### 使用官方 CLI + +```bash +# 安装 uni-app CLI +npm install -g @dcloudio/uvm + +# 创建项目 +npx degit dcloudio/uni-preset-vue my-project +``` + +## 项目运行命令 + +### 开发环境 + +```bash +# H5 平台 +npm run dev:h5 + +# 微信小程序 +npm run dev:mp-weixin + +# 支付宝小程序 +npm run dev:mp-alipay + +# 百度小程序 +npm run dev:mp-baidu + +# 字节跳动小程序 +npm run dev:mp-toutiao + +# QQ 小程序 +npm run dev:mp-qq + +# 快手小程序 +npm run dev:mp-kuaishou + +# App(需要 HBuilderX) +npm run dev:app-plus + +# 快应用 +npm run dev:quickapp-webview +``` + +### 生产环境 + +```bash +# H5 平台 +npm run build:h5 + +# 微信小程序 +npm run build:mp-weixin + +# 支付宝小程序 +npm run build:mp-alipay + +# 百度小程序 +npm run build:mp-baidu + +# 字节跳动小程序 +npm run build:mp-toutiao + +# QQ 小程序 +npm run build:mp-qq + +# 快手小程序 +npm run build:mp-kuaishou + +# App(需要 HBuilderX) +npm run build:app-plus + +# 快应用 +npm run build:quickapp-webview +``` + +## 常用命令 + +### 安装依赖 + +```bash +# 安装项目依赖 +npm install + +# 或使用 yarn +yarn install + +# 或使用 pnpm +pnpm install +``` + +### 清理构建 + +```bash +# 清理 dist 目录 +npm run clean + +# 或手动删除 +rm -rf dist +``` + +### 代码检查 + +```bash +# ESLint 检查 +npm run lint + +# 自动修复 +npm run lint:fix +``` + +## 一键创建项目脚本 + +### 创建 Vue 2 项目 + +```bash +#!/bin/bash +# create-vue2-project.sh + +PROJECT_NAME=$1 + +if [ -z "$PROJECT_NAME" ]; then + echo "Usage: ./create-vue2-project.sh " + exit 1 +fi + +echo "Creating Vue 2 uni-app project: $PROJECT_NAME" +npx degit dcloudio/uni-preset-vue $PROJECT_NAME +cd $PROJECT_NAME +npm install +echo "Project created successfully!" +echo "Run 'npm run dev:h5' to start development server" +``` + +### 创建 Vue 3 项目 + +```bash +#!/bin/bash +# create-vue3-project.sh + +PROJECT_NAME=$1 + +if [ -z "$PROJECT_NAME" ]; then + echo "Usage: ./create-vue3-project.sh " + exit 1 +fi + +echo "Creating Vue 3 uni-app project: $PROJECT_NAME" +npx degit dcloudio/uni-preset-vue#vite-ts $PROJECT_NAME +cd $PROJECT_NAME +npm install +echo "Project created successfully!" +echo "Run 'npm run dev:h5' to start development server" +``` + +## 快速命令别名 + +在 `~/.bashrc` 或 `~/.zshrc` 中添加: + +```bash +# uni-app 快速创建 +alias uniapp-create="npx degit dcloudio/uni-preset-vue" + +# uni-app 运行 H5 +alias uniapp-dev-h5="npm run dev:h5" + +# uni-app 运行微信小程序 +alias uniapp-dev-weixin="npm run dev:mp-weixin" + +# uni-app 构建 H5 +alias uniapp-build-h5="npm run build:h5" + +# uni-app 构建微信小程序 +alias uniapp-build-weixin="npm run build:mp-weixin" +``` + +使用: + +```bash +# 创建项目 +uniapp-create my-project + +# 运行 H5 +uniapp-dev-h5 + +# 构建微信小程序 +uniapp-build-weixin +``` + +## 项目初始化完整流程 + +```bash +# 1. 创建项目 +npx degit dcloudio/uni-preset-vue my-project + +# 2. 进入项目目录 +cd my-project + +# 3. 安装依赖 +npm install + +# 4. 初始化 Git(可选) +git init +git add . +git commit -m "Initial commit" + +# 5. 运行项目 +npm run dev:h5 +``` + +## 多平台同时运行 + +```bash +# 使用 concurrently 同时运行多个平台 +npm install -g concurrently + +# 同时运行 H5 和微信小程序 +concurrently "npm run dev:h5" "npm run dev:mp-weixin" +``` + +## 自定义构建命令 + +在 `package.json` 中添加: + +```json +{ + "scripts": { + "dev": "npm run dev:h5", + "build": "npm run build:h5", + "dev:all": "concurrently \"npm run dev:h5\" \"npm run dev:mp-weixin\"", + "build:all": "npm run build:h5 && npm run build:mp-weixin" + } +} +``` + +## 常见问题解决 + +### 端口被占用 + +```bash +# 修改端口(在 vite.config.js 或 webpack 配置中) +# 或使用环境变量 +PORT=3000 npm run dev:h5 +``` + +### 清除缓存 + +```bash +# 清除 node_modules 和重新安装 +rm -rf node_modules package-lock.json +npm install + +# 清除构建缓存 +rm -rf dist .cache +``` + +## 参考资源 + +- Vue CLI 文档:https://cli.vuejs.org/ +- npm 文档:https://docs.npmjs.com/ +- uni-app CLI 文档:https://uniapp.dcloud.net.cn/quickstart-cli.html diff --git a/.agents/bak-skills/uniapp-project-creator/templates/project-templates.md b/.agents/bak-skills/uniapp-project-creator/templates/project-templates.md new file mode 100644 index 0000000..7ea0d84 --- /dev/null +++ b/.agents/bak-skills/uniapp-project-creator/templates/project-templates.md @@ -0,0 +1,501 @@ +# uni-app 项目模板 + +## 官方文档 + +参考官方文档:https://uniapp.dcloud.net.cn/quickstart-cli.html + +## 标准项目结构 + +``` +my-uniapp-project/ +├── pages/ # 页面目录 +│ ├── index/ +│ │ └── index.vue # 首页 +│ └── ... +├── components/ # 组件目录 +│ └── ... +├── static/ # 静态资源 +│ ├── images/ +│ ├── icons/ +│ └── ... +├── uni_modules/ # uni_modules 插件 +├── utils/ # 工具函数 +│ ├── request.js # 网络请求封装 +│ └── ... +├── api/ # API 接口 +│ └── ... +├── store/ # 状态管理(Vuex/Pinia) +│ └── ... +├── App.vue # 应用入口 +├── main.js # 入口文件 +├── manifest.json # 应用配置 +├── pages.json # 页面路由配置 +├── uni.scss # 全局样式 +└── package.json # 项目依赖 +``` + +## manifest.json 模板 + +### 基础配置 + +```json +{ + "name": "my-uniapp", + "appid": "", + "description": "uni-app 项目", + "versionName": "1.0.0", + "versionCode": "100", + "transformPx": false, + "app-plus": { + "usingComponents": true, + "nvueStyleCompiler": "uni-app", + "compilerVersion": 3, + "splashscreen": { + "alwaysShowBeforeRender": true, + "waiting": true, + "autoclose": true, + "delay": 0 + }, + "modules": {}, + "distribute": { + "android": { + "permissions": [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ] + }, + "ios": {}, + "sdkConfigs": {} + } + }, + "quickapp": {}, + "mp-weixin": { + "appid": "", + "setting": { + "urlCheck": false + }, + "usingComponents": true + }, + "mp-alipay": { + "usingComponents": true + }, + "mp-baidu": { + "usingComponents": true + }, + "mp-toutiao": { + "usingComponents": true + }, + "h5": { + "router": { + "mode": "hash", + "base": "/" + } + }, + "vueVersion": "2" +} +``` + +### Vue 3 配置 + +```json +{ + "name": "my-uniapp-vue3", + "appid": "", + "description": "uni-app Vue 3 项目", + "versionName": "1.0.0", + "versionCode": "100", + "transformPx": false, + "vueVersion": "3", + "app-plus": { + "usingComponents": true, + "compilerVersion": 3 + }, + "h5": { + "router": { + "mode": "hash", + "base": "/" + } + }, + "mp-weixin": { + "appid": "", + "setting": { + "urlCheck": false + }, + "usingComponents": true + } +} +``` + +## pages.json 模板 + +### 基础配置 + +```json +{ + "pages": [ + { + "path": "pages/index/index", + "style": { + "navigationBarTitleText": "首页" + } + } + ], + "globalStyle": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "uni-app", + "navigationBarBackgroundColor": "#F8F8F8", + "backgroundColor": "#F8F8F8" + } +} +``` + +### 带 TabBar 配置 + +```json +{ + "pages": [ + { + "path": "pages/index/index", + "style": { + "navigationBarTitleText": "首页" + } + }, + { + "path": "pages/category/category", + "style": { + "navigationBarTitleText": "分类" + } + }, + { + "path": "pages/cart/cart", + "style": { + "navigationBarTitleText": "购物车" + } + }, + { + "path": "pages/user/user", + "style": { + "navigationBarTitleText": "我的" + } + } + ], + "globalStyle": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "uni-app", + "navigationBarBackgroundColor": "#F8F8F8", + "backgroundColor": "#F8F8F8" + }, + "tabBar": { + "color": "#7A7E83", + "selectedColor": "#3cc51f", + "borderStyle": "black", + "backgroundColor": "#ffffff", + "list": [ + { + "pagePath": "pages/index/index", + "iconPath": "static/tab-home.png", + "selectedIconPath": "static/tab-home-current.png", + "text": "首页" + }, + { + "pagePath": "pages/category/category", + "iconPath": "static/tab-category.png", + "selectedIconPath": "static/tab-category-current.png", + "text": "分类" + }, + { + "pagePath": "pages/cart/cart", + "iconPath": "static/tab-cart.png", + "selectedIconPath": "static/tab-cart-current.png", + "text": "购物车" + }, + { + "pagePath": "pages/user/user", + "iconPath": "static/tab-user.png", + "selectedIconPath": "static/tab-user-current.png", + "text": "我的" + } + ] + } +} +``` + +## 页面模板 + +### Vue 2 页面模板 + +```vue + + + + + +``` + +### Vue 3 页面模板(Composition API) + +```vue + + + + + +``` + +## 组件模板 + +### Vue 2 组件模板 + +```vue + + + + + +``` + +### Vue 3 组件模板(Composition API) + +```vue + + + + + +``` + +## App.vue 模板 + +### Vue 2 App.vue + +```vue + + + + + +``` + +### Vue 3 App.vue + +```vue + + + + + +``` + +## main.js 模板 + +### Vue 2 main.js + +```javascript +import { createSSRApp } from 'vue' +import App from './App.vue' + +export function createApp() { + const app = createSSRApp(App) + return { + app + } +} +``` + +### Vue 3 main.js + +```javascript +import { createSSRApp } from 'vue' +import App from './App.vue' + +export function createApp() { + const app = createSSRApp(App) + return { + app + } +} +``` + +## 使用说明 + +1. 根据项目类型选择合适的模板 +2. 复制模板代码到对应文件 +3. 根据项目需求修改配置 +4. 添加页面和组件 diff --git a/.agents/bak-skills/uniapp-ucharts/LICENSE.txt b/.agents/bak-skills/uniapp-ucharts/LICENSE.txt new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/.agents/bak-skills/uniapp-ucharts/LICENSE.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/.agents/bak-skills/uniapp-ucharts/SKILL.md b/.agents/bak-skills/uniapp-ucharts/SKILL.md new file mode 100644 index 0000000..2570009 --- /dev/null +++ b/.agents/bak-skills/uniapp-ucharts/SKILL.md @@ -0,0 +1,157 @@ +--- +name: uniapp-ucharts +description: A comprehensive skill for integrating and using uCharts with UniApp projects. This skill focuses on UniApp-specific integration, configuration, and platform-specific considerations when using uCharts in UniApp applications. Use this skill whenever the user needs to integrate uCharts into UniApp projects, configure UniApp-specific settings, or handle platform differences. +license: Complete terms in LICENSE.txt +--- + +## When to use this skill + +Use this skill whenever the user wants to: +- Integrate uCharts into UniApp projects +- Configure UniApp projects to work with uCharts (pages.json, manifest.json, easycom) +- Handle platform-specific behaviors when using uCharts in UniApp (H5, mini-program, App, nvue) +- Use UniApp features (navigation, APIs, lifecycle) with uCharts components +- Build cross-platform UniApp applications with uCharts charts +- Configure easycom for automatic uCharts component import in UniApp +- Handle navigation and routing with uCharts in UniApp +- Optimize UniApp projects using uCharts +- Deploy uCharts-based UniApp applications to multiple platforms + +## How to use this skill + +This skill is organized to match UniApp integration patterns and the official UniApp plugin structure (https://ext.dcloud.net.cn/plugin?id=271). When working with uCharts in UniApp: + +1. **Install and setup** uCharts in UniApp project: + - Load `examples/getting-started/installation.md` for installation in UniApp + - Load `examples/getting-started/project-setup.md` for UniApp project configuration + - Load `examples/getting-started/easycom-config.md` for easycom configuration + +2. **Integrate with UniApp features**: + - Load `examples/integration/pages-config.md` for pages.json configuration + - Load `examples/integration/manifest-config.md` for manifest.json configuration + - Load `examples/integration/navigation.md` for navigation with uCharts + - Load `examples/integration/uni-api.md` for using UniApp APIs with uCharts + +3. **Handle platform-specific behaviors**: + - Load `examples/platform-specific/h5.md` for H5 platform considerations + - Load `examples/platform-specific/miniprogram.md` for mini-program considerations + - Load `examples/platform-specific/app.md` for App platform considerations + - Load `examples/platform-specific/nvue.md` for nvue considerations + +4. **Advanced integration**: + - Load `examples/advanced/custom-theme.md` for theme customization in UniApp + - Load `examples/advanced/build-optimization.md` for build optimization + - Load `examples/advanced/multi-platform.md` for multi-platform deployment + +5. **Reference the API documentation** when needed: + - `api/integration-api.md` - UniApp and uCharts integration API + - `api/config-api.md` - Configuration API reference + +6. **Use templates** for quick start: + - `templates/basic-uniapp-project.md` - Basic UniApp project with uCharts + - `templates/pages-template.md` - Pages configuration template + - `templates/manifest-template.md` - Manifest configuration template + +**Important Notes**: +- This skill focuses on UniApp integration, not uCharts API documentation +- Always configure easycom in pages.json for automatic component import +- Use conditional compilation (`#ifdef`, `#endif`) for platform-specific code +- Test on all target platforms (H5, mini-programs, App) before deployment +- Use rpx units for responsive sizing in UniApp + +## Examples and Templates + +### Getting Started +- **Installation**: `examples/getting-started/installation.md` - How to install uCharts in UniApp projects +- **Project Setup**: `examples/getting-started/project-setup.md` - Setting up UniApp project with uCharts +- **Easycom Config**: `examples/getting-started/easycom-config.md` - Configuring easycom for automatic component import + +### Integration +- **Pages Config**: `examples/integration/pages-config.md` - Configuring pages.json with uCharts +- **Manifest Config**: `examples/integration/manifest-config.md` - Configuring manifest.json for uCharts +- **Navigation**: `examples/integration/navigation.md` - Navigation and routing with uCharts +- **UniApp API**: `examples/integration/uni-api.md` - Using UniApp APIs with uCharts components + +### Platform-Specific +- **H5**: `examples/platform-specific/h5.md` - H5 platform considerations with uCharts +- **Mini-Program**: `examples/platform-specific/miniprogram.md` - Mini-program considerations with uCharts +- **App**: `examples/platform-specific/app.md` - App platform considerations with uCharts +- **nvue**: `examples/platform-specific/nvue.md` - nvue considerations with uCharts + +### Advanced +- **Custom Theme**: `examples/advanced/custom-theme.md` - Customizing themes in UniApp projects +- **Build Optimization**: `examples/advanced/build-optimization.md` - Optimizing UniApp builds with uCharts +- **Multi-Platform**: `examples/advanced/multi-platform.md` - Multi-platform deployment strategies + +### Templates +- **Basic Project**: `templates/basic-uniapp-project.md` - Basic UniApp project structure with uCharts +- **Pages Template**: `templates/pages-template.md` - pages.json configuration template +- **Manifest Template**: `templates/manifest-template.md` - manifest.json configuration template + +## API Reference + +- **Integration API**: `api/integration-api.md` - UniApp and uCharts integration API reference +- **Config API**: `api/config-api.md` - Configuration API reference for UniApp projects + +## Best Practices + +1. **Use easycom**: Configure easycom in pages.json for automatic uCharts component import +2. **Platform Testing**: Test on all target platforms (H5, mini-programs, App) before deployment +3. **Use rpx Units**: Use rpx for responsive sizing in UniApp, px for fixed sizes +4. **Canvas Support**: Ensure canvas is properly supported on target platforms +5. **Manifest Configuration**: Properly configure manifest.json for each platform +6. **Conditional Compilation**: Use conditional compilation (`#ifdef`, `#endif`) for platform-specific code +7. **Performance**: Optimize for each platform's specific requirements +8. **Data Format**: Ensure data format is compatible with uCharts requirements +9. **Lifecycle Management**: Properly handle UniApp page lifecycle with uCharts instances +10. **Memory Management**: Clean up chart instances in onUnload lifecycle + +## Resources + +- **Official UniApp Plugin**: https://ext.dcloud.net.cn/plugin?id=271 +- **UniApp Documentation**: https://uniapp.dcloud.net.cn/ +- **UniApp API Reference**: https://uniapp.dcloud.net.cn/api/ + +## Keywords + +uniapp, ucharts, uniapp charts, uniapp integration, uniapp configuration, easycom, pages.json, manifest.json, uni-app, 小程序, 跨平台, H5, App, nvue, 条件编译, 平台差异, 图表, canvas, 图表组件, UniApp 图表, 跨平台图表, 小程序图表, App 图表 + +## 能力边界 + +### ✅ 适用场景 +- 当你需要使用此技能对应的技术栈时 +- 当项目需要遵循最佳实践时 +- 当需要快速上手或深入理解核心概念时 + +### ⚠️ 需要注意 +- 复杂业务逻辑需要结合具体场景调整 +- 性能优化需要根据实际数据量评估 + +### ❌ 不适用场景 +- 不相关的技术栈或框架 +- 需要完全自定义的特殊场景 + +## 常见陷阱 (Gotchas) + +1. **版本兼容性**:注意框架版本与依赖库的兼容性,不同版本 API 可能有差异 +2. **配置文件格式**:配置文件格式错误是最常见的问题,建议使用编辑器的语法检查 +3. **环境变量**:确保所有必要的环境变量已正确设置,敏感信息不要硬编码 +4. **依赖冲突**:多版本共存时注意依赖冲突,使用 lock 文件锁定版本 +5. **性能陷阱**:大数据量场景下注意性能优化,避免 N+1 查询等常见问题 + +## 使用流程 + +### Step 1: 环境准备 +确保开发环境已安装必要的依赖和工具。 + +### Step 2: 配置初始化 +根据项目需求进行基础配置。 + +### Step 3: 核心功能使用 +按照示例代码实现核心功能。 + +### Step 4: 测试验证 +运行测试确保功能正常。 + +### Step 5: 部署上线 +完成开发后进行部署和监控。 diff --git a/.agents/bak-skills/uniapp-ucharts/api/config-api.md b/.agents/bak-skills/uniapp-ucharts/api/config-api.md new file mode 100644 index 0000000..7d253d2 --- /dev/null +++ b/.agents/bak-skills/uniapp-ucharts/api/config-api.md @@ -0,0 +1,167 @@ +# Configuration API + +## 配置 API + +UniApp + uCharts 项目的配置文件 API 参考。 + +### pages.json 配置 + +#### easycom 配置 + +```json +{ + "easycom": { + "autoscan": true, + "custom": { + "qiun-data-charts": "@/uni_modules/qiun-data-charts/components/qiun-data-charts/qiun-data-charts.vue" + } + } +} +``` + +#### pages 配置 + +```json +{ + "pages": [ + { + "path": "pages/index/index", + "style": { + "navigationBarTitleText": "首页", + "navigationStyle": "default" | "custom", + "navigationBarBackgroundColor": "#ffffff", + "navigationBarTextStyle": "black" | "white", + "backgroundColor": "#f5f5f5", + "enablePullDownRefresh": true, + "onReachBottomDistance": 50 + } + } + ] +} +``` + +#### globalStyle 配置 + +```json +{ + "globalStyle": { + "navigationBarTextStyle": "black" | "white", + "navigationBarTitleText": "UniApp", + "navigationBarBackgroundColor": "#ffffff", + "backgroundColor": "#f5f5f5" + } +} +``` + +### manifest.json 配置 + +#### 基本配置 + +```json +{ + "name": "uniapp-ucharts-project", + "appid": "", + "versionName": "1.0.0", + "versionCode": "100", + "transformPx": false +} +``` + +#### H5 配置 + +```json +{ + "h5": { + "router": { + "mode": "hash" | "history", + "base": "/" + }, + "devServer": { + "https": false, + "port": 8080 + } + } +} +``` + +#### 微信小程序配置 + +```json +{ + "mp-weixin": { + "appid": "your-appid", + "setting": { + "urlCheck": false, + "es6": true, + "enhance": true, + "postcss": true, + "minified": true + }, + "usingComponents": true + } +} +``` + +#### App 配置 + +```json +{ + "app-plus": { + "usingComponents": true, + "nvueStyleCompiler": "uni-app", + "distribute": { + "android": { + "permissions": [] + }, + "ios": {} + } + } +} +``` + +### uni.scss 配置 + +```scss +/* uni.scss */ +/* 自定义变量 */ +$uni-color-primary: #409EFF; +$uni-bg-color: #f5f5f5; +``` + +### App.vue 配置 + +```vue + +``` + +### main.js 配置 + +#### Vue 2 + +```javascript +import App from './App' + +Vue.config.productionTip = false +App.mpType = 'app' +const app = new Vue({ + ...App +}) +app.$mount() +``` + +#### Vue 3 + +```javascript +import { createSSRApp } from 'vue' +import App from './App' + +export function createApp() { + const app = createSSRApp(App) + return { app } +} +``` diff --git a/.agents/bak-skills/uniapp-ucharts/api/integration-api.md b/.agents/bak-skills/uniapp-ucharts/api/integration-api.md new file mode 100644 index 0000000..ec825e7 --- /dev/null +++ b/.agents/bak-skills/uniapp-ucharts/api/integration-api.md @@ -0,0 +1,153 @@ +# Integration API + +## UniApp 与 uCharts 整合 API + +UniApp 与 uCharts 整合使用的 API 参考。 + +### easycom 配置 API + +```json +{ + "easycom": { + "autoscan": boolean, + "custom": { + "qiun-data-charts": "string" + } + } +} +``` + +### pages.json API + +```json +{ + "pages": [ + { + "path": "string", + "style": { + "navigationBarTitleText": "string", + "navigationStyle": "default" | "custom", + "navigationBarBackgroundColor": "string", + "navigationBarTextStyle": "black" | "white", + "enablePullDownRefresh": boolean, + "onReachBottomDistance": number + } + } + ], + "globalStyle": { + "navigationBarTextStyle": "black" | "white", + "navigationBarTitleText": "string", + "navigationBarBackgroundColor": "string", + "backgroundColor": "string" + } +} +``` + +### manifest.json API + +```json +{ + "name": "string", + "appid": "string", + "versionName": "string", + "versionCode": "string", + "transformPx": boolean, + "app-plus": { + "usingComponents": boolean, + "nvueStyleCompiler": "uni-app" | "weex" + }, + "h5": { + "router": { + "mode": "hash" | "history", + "base": "string" + } + }, + "mp-weixin": { + "appid": "string", + "setting": { + "urlCheck": boolean, + "es6": boolean, + "enhance": boolean, + "postcss": boolean, + "minified": boolean + }, + "usingComponents": boolean + } +} +``` + +### UniApp API 与 uCharts 配合 + +#### 导航 API + +```javascript +// 页面跳转 +uni.navigateTo({ + url: 'string', + success: function, + fail: function, + complete: function +}) + +// 页面返回 +uni.navigateBack({ + delta: number +}) +``` + +#### 网络请求 API + +```javascript +uni.request({ + url: 'string', + method: 'GET' | 'POST' | 'PUT' | 'DELETE', + data: object, + header: object, + success: function, + fail: function, + complete: function +}) +``` + +#### 存储 API + +```javascript +// 存储数据 +uni.setStorage({ + key: 'string', + data: any, + success: function, + fail: function +}) + +// 获取数据 +uni.getStorage({ + key: 'string', + success: function, + fail: function +}) +``` + +### 条件编译 API + +```javascript +// #ifdef 平台名称 +// 平台特定代码 +// #endif + +// #ifndef 平台名称 +// 非平台特定代码 +// #endif + +// #ifdef H5 +// H5 平台代码 +// #endif + +// #ifdef MP-WEIXIN +// 微信小程序代码 +// #endif + +// #ifdef APP-PLUS +// App 平台代码 +// #endif +``` diff --git a/.agents/bak-skills/uniapp-ucharts/examples/advanced/build-optimization.md b/.agents/bak-skills/uniapp-ucharts/examples/advanced/build-optimization.md new file mode 100644 index 0000000..661b7b3 --- /dev/null +++ b/.agents/bak-skills/uniapp-ucharts/examples/advanced/build-optimization.md @@ -0,0 +1,100 @@ +# Build Optimization + +## 构建优化 + +优化 UniApp + uCharts 项目的构建和性能。 + +### 代码分割 + +使用条件编译减少代码体积: + +```vue + +``` + +### 组件按需引入 + +虽然 easycom 会自动引入,但可以优化: + +```json +{ + "easycom": { + "autoscan": true, + "custom": { + "qiun-data-charts": "@/uni_modules/qiun-data-charts/components/qiun-data-charts/qiun-data-charts.vue" + } + } +} +``` + +### 图表数据优化 + +```vue + +``` + +### 打包配置 + +在 manifest.json 中配置打包选项: + +```json +{ + "mp-weixin": { + "setting": { + "minified": true, + "postcss": true + } + }, + "h5": { + "optimization": { + "treeShaking": { + "enable": true + } + } + } +} +``` + +### 注意事项 + +1. **条件编译**:使用条件编译减少代码体积 +2. **数据优化**:合理控制数据量,避免过大 +3. **配置优化**:合理配置图表选项,提高性能 +4. **打包配置**:正确配置打包选项 +5. **性能测试**:在不同平台测试性能 diff --git a/.agents/bak-skills/uniapp-ucharts/examples/advanced/custom-theme.md b/.agents/bak-skills/uniapp-ucharts/examples/advanced/custom-theme.md new file mode 100644 index 0000000..ea33349 --- /dev/null +++ b/.agents/bak-skills/uniapp-ucharts/examples/advanced/custom-theme.md @@ -0,0 +1,117 @@ +# Custom Theme + +## 自定义主题 + +在 UniApp 项目中自定义 uCharts 主题。 + +### 配置主题颜色 + +在图表配置中设置主题颜色: + +```vue + + + +``` + +### 使用 SCSS 变量 + +在 `uni.scss` 中定义主题变量: + +```scss +/* uni.scss */ +$chart-primary-color: #409EFF; +$chart-success-color: #67C23A; +$chart-warning-color: #E6A23C; +$chart-error-color: #F56C6C; +``` + +在组件中使用: + +```vue + +``` + +### 条件编译主题 + +不同平台可以使用不同主题: + +```vue + +``` + +### 注意事项 + +1. **颜色配置**:使用合理的颜色搭配 +2. **平台差异**:使用条件编译处理平台差异 +3. **主题一致性**:保持应用主题一致性 +4. **可读性**:确保图表颜色具有良好的可读性 +5. **测试验证**:在不同平台测试主题效果 diff --git a/.agents/bak-skills/uniapp-ucharts/examples/advanced/multi-platform.md b/.agents/bak-skills/uniapp-ucharts/examples/advanced/multi-platform.md new file mode 100644 index 0000000..d653f66 --- /dev/null +++ b/.agents/bak-skills/uniapp-ucharts/examples/advanced/multi-platform.md @@ -0,0 +1,105 @@ +# Multi-Platform Deployment + +## 多平台部署 + +UniApp + uCharts 项目支持多平台部署的策略和注意事项。 + +### 平台差异处理 + +使用条件编译处理平台差异: + +```vue + + + +``` + +### 统一 API 封装 + +封装统一的 API 调用: + +```javascript +// utils/api.js +export function request(url, options = {}) { + return new Promise((resolve, reject) => { + uni.request({ + url, + ...options, + success: (res) => { + resolve(res.data) + }, + fail: (err) => { + reject(err) + } + }) + }) +} +``` + +### 平台特定配置 + +在 manifest.json 中配置各平台: + +```json +{ + "h5": { + "router": { + "mode": "hash" + } + }, + "mp-weixin": { + "appid": "your-appid" + }, + "app-plus": { + "usingComponents": true + } +} +``` + +### 注意事项 + +1. **条件编译**:使用条件编译处理平台差异 +2. **API 统一**:封装统一的 API 调用 +3. **配置管理**:正确配置各平台参数 +4. **测试验证**:在各平台测试功能 +5. **文档记录**:记录平台差异和注意事项 diff --git a/.agents/bak-skills/uniapp-ucharts/examples/getting-started/easycom-config.md b/.agents/bak-skills/uniapp-ucharts/examples/getting-started/easycom-config.md new file mode 100644 index 0000000..9e2a98f --- /dev/null +++ b/.agents/bak-skills/uniapp-ucharts/examples/getting-started/easycom-config.md @@ -0,0 +1,196 @@ +# Easycom Configuration + +## Easycom 配置 + +easycom 是 UniApp 的自动引入机制,配置后可以自动引入 uCharts 组件,无需手动 import。 + +### 基本配置 + +在 `pages.json` 中配置 easycom: + +```json +{ + "easycom": { + "autoscan": true, + "custom": { + "qiun-data-charts": "@/uni_modules/qiun-data-charts/components/qiun-data-charts/qiun-data-charts.vue" + } + } +} +``` + +### 配置说明 + +- `autoscan: true`:开启自动扫描 +- `custom`:自定义规则 +- `qiun-data-charts`:组件名称 +- `@/uni_modules/qiun-data-charts/components/qiun-data-charts/qiun-data-charts.vue`:组件路径 + +### 使用示例 + +配置后,可以直接使用组件,无需引入: + +```vue + + + +``` + +### 完整 pages.json 示例 + +```json +{ + "easycom": { + "autoscan": true, + "custom": { + "qiun-data-charts": "@/uni_modules/qiun-data-charts/components/qiun-data-charts/qiun-data-charts.vue" + } + }, + "pages": [ + { + "path": "pages/index/index", + "style": { + "navigationBarTitleText": "首页" + } + } + ], + "globalStyle": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "UniApp", + "navigationBarBackgroundColor": "#ffffff", + "backgroundColor": "#f5f5f5" + } +} +``` + +### 自定义组件路径 + +如果 uCharts 安装在不同位置,需要调整路径: + +#### npm 安装 + +```json +{ + "easycom": { + "autoscan": true, + "custom": { + "qiun-data-charts": "@/node_modules/@qiun/ucharts/components/qiun-data-charts/qiun-data-charts.vue" + } + } +} +``` + +#### uni_modules 安装 + +```json +{ + "easycom": { + "autoscan": true, + "custom": { + "qiun-data-charts": "@/uni_modules/qiun-data-charts/components/qiun-data-charts/qiun-data-charts.vue" + } + } +} +``` + +### 禁用 easycom + +如果不想使用 easycom,可以手动引入: + +```vue + + + +``` + +### 验证配置 + +创建测试页面验证 easycom 是否生效: + +```vue + + + +``` + +如果图表正常显示且无报错,说明 easycom 配置成功。 + +## 注意事项 + +1. **路径必须正确**:确保组件路径与实际安装位置一致 +2. **组件名称**:uCharts 组件名称为 `qiun-data-charts` +3. **重启项目**:修改 easycom 配置后需要重启项目 +4. **优先级**:easycom 优先级高于手动引入 +5. **性能**:easycom 不会影响性能,按需加载组件 diff --git a/.agents/bak-skills/uniapp-ucharts/examples/getting-started/installation.md b/.agents/bak-skills/uniapp-ucharts/examples/getting-started/installation.md new file mode 100644 index 0000000..66ee698 --- /dev/null +++ b/.agents/bak-skills/uniapp-ucharts/examples/getting-started/installation.md @@ -0,0 +1,226 @@ +# Installation | 安装 + +## Instructions + +This example demonstrates how to install uCharts in UniApp projects via DCloud plugin marketplace (plugin ID: 271). + +### Key Concepts + +- Installing uCharts via DCloud plugin marketplace +- Installing via npm +- Project structure setup +- Component import methods +- Easycom configuration + +### Example: Install via DCloud Plugin Marketplace (Recommended) + +**Official Plugin**: https://ext.dcloud.net.cn/plugin?id=271 + +```bash +# 1. Open HBuilderX +# 2. Go to Tools -> Plugin Installation +# 3. Search for "uCharts" or enter plugin ID: 271 +# 4. Click "Import Plugin" +# 5. Plugin will be installed to uni_modules/qiun-data-charts directory +``` + +**Project Structure After Installation:** +``` +project-root/ +├── uni_modules/ +│ └── qiun-data-charts/ +│ ├── components/ +│ │ └── qiun-data-charts/ +│ └── ... +├── pages/ +├── pages.json +└── manifest.json +``` + +### Example: Install via npm + +```bash +# Install uCharts package +npm install @qiun/ucharts + +# Or using yarn +yarn add @qiun/ucharts +``` + +**Import in Component:** +```javascript +// pages/chart/chart.vue +import uCharts from '@qiun/ucharts' + +export default { + onReady() { + // Use uCharts here + } +} +``` + +### Example: Manual Installation + +```bash +# 1. Download from DCloud plugin marketplace +# 2. Extract to project root +# 3. Ensure uni_modules/qiun-data-charts/ exists +``` + +## UniApp 项目配置 + +### 1. 引入 uCharts + +在页面中引入 uCharts 组件: + +```vue + + + +``` + +### 2. 配置 easycom(推荐) + +在 `pages.json` 中配置 easycom,实现组件自动引入: + +```json +{ + "easycom": { + "autoscan": true, + "custom": { + "qiun-data-charts": "@/uni_modules/qiun-data-charts/components/qiun-data-charts/qiun-data-charts.vue" + } + }, + "pages": [ + // ... 页面配置 + ] +} +``` + +### 3. 验证安装 + +创建测试页面验证安装是否成功: + +```vue + + + + + +``` + +如果图表正常显示,说明安装成功。 + +## 目录结构 + +安装后的项目结构: + +``` +uniapp-project/ +├── uni_modules/ +│ └── qiun-data-charts/ # uCharts 插件 +│ ├── components/ # 组件目录 +│ └── ucharts/ # uCharts 核心文件 +├── pages/ # 页面目录 +├── static/ # 静态资源 +├── App.vue # 应用入口 +├── main.js # 主入口文件 +├── pages.json # 页面配置 +├── manifest.json # 应用配置 +└── uni.scss # 全局样式变量 +``` + +### Example: Verify Installation + +```vue + + + + +``` + +### Key Points + +- Install via DCloud plugin marketplace for easiest integration +- Plugin ID: 271 +- Component will be in `uni_modules/qiun-data-charts/components/qiun-data-charts/` +- Configure easycom in pages.json for automatic import +- Test installation by using the component in a page +- Ensure canvas is supported on target platforms diff --git a/.agents/bak-skills/uniapp-ucharts/examples/getting-started/project-setup.md b/.agents/bak-skills/uniapp-ucharts/examples/getting-started/project-setup.md new file mode 100644 index 0000000..2844862 --- /dev/null +++ b/.agents/bak-skills/uniapp-ucharts/examples/getting-started/project-setup.md @@ -0,0 +1,246 @@ +# Project Setup + +## UniApp 项目配置 + +配置 UniApp 项目以正确使用 uCharts。 + +### 项目结构 + +标准的 UniApp + uCharts 项目结构: + +``` +uniapp-project/ +├── uni_modules/ +│ └── qiun-data-charts/ # uCharts 插件 +├── pages/ # 页面目录 +│ ├── index/ +│ │ └── index.vue +│ └── ... +├── components/ # 自定义组件 +├── static/ # 静态资源 +├── utils/ # 工具函数 +├── App.vue # 应用入口 +├── main.js # 主入口文件 +├── pages.json # 页面配置 +├── manifest.json # 应用配置 +└── uni.scss # 全局样式变量 +``` + +### App.vue 配置 + +```vue + + + + + +``` + +### main.js 配置 + +```javascript +import App from './App' + +// #ifdef VUE3 +import { createSSRApp } from 'vue' +export function createApp() { + const app = createSSRApp(App) + return { + app + } +} +// #endif + +// #ifndef VUE3 +import Vue from 'vue' +Vue.config.productionTip = false +App.mpType = 'app' +const app = new Vue({ + ...App +}) +app.$mount() +// #endif +``` + +### pages.json 配置 + +```json +{ + "easycom": { + "autoscan": true, + "custom": { + "qiun-data-charts": "@/uni_modules/qiun-data-charts/components/qiun-data-charts/qiun-data-charts.vue" + } + }, + "pages": [ + { + "path": "pages/index/index", + "style": { + "navigationBarTitleText": "首页" + } + } + ], + "globalStyle": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "UniApp", + "navigationBarBackgroundColor": "#ffffff", + "backgroundColor": "#f5f5f5" + } +} +``` + +### uni.scss 配置 + +```scss +/* uni.scss */ +/* 自定义全局变量 */ +$uni-color-primary: #409EFF; +$uni-bg-color: #f5f5f5; +``` + +### manifest.json 配置要点 + +```json +{ + "name": "uniapp-ucharts-project", + "appid": "", + "description": "", + "versionName": "1.0.0", + "versionCode": "100", + "transformPx": false, + "app-plus": { + "usingComponents": true + }, + "h5": { + "router": { + "mode": "hash" + } + }, + "mp-weixin": { + "appid": "", + "setting": { + "urlCheck": false + }, + "usingComponents": true + } +} +``` + +## 开发环境配置 + +### HBuilderX 配置 + +1. **启用 Canvas 支持**: + - 确保项目支持 Canvas + - 检查平台是否支持 Canvas + +2. **配置编译器**: + - 工具 → 选项 → HBuilderX → 编译器 + - 确保启用相关编译选项 + +### 条件编译 + +使用条件编译处理平台差异: + +```vue + +``` + +## 验证配置 + +创建测试页面验证配置是否正确: + +```vue + + + + + +``` + +## 注意事项 + +1. **easycom 必须配置**:否则需要手动引入组件 +2. **Canvas 支持**:确保目标平台支持 Canvas +3. **容器高度**:图表容器必须有明确的高度 +4. **数据格式**:确保数据格式符合 uCharts 要求 +5. **平台测试**:在不同平台测试图表功能 +6. **性能优化**:注意图表性能,避免过多图表 diff --git a/.agents/bak-skills/uniapp-ucharts/examples/integration/manifest-config.md b/.agents/bak-skills/uniapp-ucharts/examples/integration/manifest-config.md new file mode 100644 index 0000000..fdb754d --- /dev/null +++ b/.agents/bak-skills/uniapp-ucharts/examples/integration/manifest-config.md @@ -0,0 +1,163 @@ +# Manifest Configuration + +## manifest.json 配置 + +`manifest.json` 是 UniApp 的应用配置文件,需要正确配置以支持 uCharts 在不同平台运行。 + +### 基本配置 + +```json +{ + "name": "uniapp-ucharts-project", + "appid": "", + "description": "", + "versionName": "1.0.0", + "versionCode": "100", + "transformPx": false, + "app-plus": { + "usingComponents": true + }, + "h5": { + "router": { + "mode": "hash" + } + }, + "mp-weixin": { + "appid": "", + "setting": { + "urlCheck": false + }, + "usingComponents": true + } +} +``` + +### H5 平台配置 + +```json +{ + "h5": { + "router": { + "mode": "hash", + "base": "/" + }, + "devServer": { + "https": false, + "port": 8080 + }, + "publicPath": "/", + "template": "index.html" + } +} +``` + +### 微信小程序配置 + +```json +{ + "mp-weixin": { + "appid": "your-appid", + "setting": { + "urlCheck": false, + "es6": true, + "enhance": true, + "postcss": true, + "minified": true + }, + "usingComponents": true, + "permission": { + "scope.userLocation": { + "desc": "你的位置信息将用于小程序位置接口的效果展示" + } + } + } +} +``` + +### App 平台配置 + +```json +{ + "app-plus": { + "usingComponents": true, + "nvueStyleCompiler": "uni-app", + "splashscreen": { + "alwaysShowBeforeRender": true, + "waiting": true, + "autoclose": true, + "delay": 0 + }, + "distribute": { + "android": { + "permissions": [ + "" + ] + }, + "ios": {} + } + } +} +``` + +### 完整配置示例 + +```json +{ + "name": "uniapp-ucharts-project", + "appid": "", + "description": "UniApp + uCharts 项目", + "versionName": "1.0.0", + "versionCode": "100", + "transformPx": false, + "app-plus": { + "usingComponents": true, + "nvueStyleCompiler": "uni-app" + }, + "h5": { + "router": { + "mode": "hash" + }, + "devServer": { + "port": 8080 + } + }, + "mp-weixin": { + "appid": "", + "setting": { + "urlCheck": false, + "es6": true, + "enhance": true, + "postcss": true, + "minified": true + }, + "usingComponents": true + } +} +``` + +## 关键配置说明 + +### usingComponents + +所有平台都需要设置 `"usingComponents": true`,以支持组件使用。 + +### transformPx + +建议设置为 `false`,使用 rpx 单位进行响应式布局。 + +### Canvas 支持 + +uCharts 依赖 Canvas,确保目标平台支持 Canvas: + +- **H5**:完全支持 Canvas +- **小程序**:支持 Canvas,但可能有性能限制 +- **App**:支持 Canvas,但 nvue 可能有限制 + +## 注意事项 + +1. **usingComponents**:必须设置为 true +2. **平台差异**:不同平台对 Canvas 的支持可能有差异 +3. **AppID**:小程序平台需要配置对应的 AppID +4. **权限配置**:根据功能需求配置相应权限 +5. **版本号**:正确配置版本号和版本名称 +6. **Canvas 兼容性**:注意不同平台的 Canvas 兼容性 diff --git a/.agents/bak-skills/uniapp-ucharts/examples/integration/navigation.md b/.agents/bak-skills/uniapp-ucharts/examples/integration/navigation.md new file mode 100644 index 0000000..73566f1 --- /dev/null +++ b/.agents/bak-skills/uniapp-ucharts/examples/integration/navigation.md @@ -0,0 +1,165 @@ +# Navigation + +## 导航和路由 + +在 UniApp 中使用 uCharts 组件进行页面导航和路由管理。 + +### 使用 UniApp 导航 API + +#### 页面跳转 + +```javascript +// 保留当前页面,跳转到应用内的某个页面 +uni.navigateTo({ + url: '/pages/chart/chart?type=line' +}) + +// 关闭当前页面,跳转到应用内的某个页面 +uni.redirectTo({ + url: '/pages/chart/chart?type=bar' +}) + +// 返回上一页面 +uni.navigateBack({ + delta: 1 +}) +``` + +#### 使用按钮进行跳转 + +```vue + + + +``` + +### 页面传参 + +#### 传递参数 + +```javascript +// 跳转并传递参数 +uni.navigateTo({ + url: '/pages/chart/chart?type=line&title=折线图' +}) +``` + +#### 接收参数 + +```vue + + + +``` + +### TabBar 导航 + +#### 使用原生 TabBar + +```json +{ + "tabBar": { + "color": "#7A7E83", + "selectedColor": "#409EFF", + "borderStyle": "black", + "backgroundColor": "#ffffff", + "list": [ + { + "pagePath": "pages/index/index", + "text": "首页" + }, + { + "pagePath": "pages/chart/chart", + "text": "图表" + } + ] + } +} +``` + +### 图表页面导航示例 + +```vue + + + +``` + +## 注意事项 + +1. **路径格式**:路径必须以 `/` 开头 +2. **参数传递**:URL 参数需要编码 +3. **页面栈**:注意页面栈限制(最多 10 层) +4. **数据加载**:跳转后及时加载图表数据 +5. **性能优化**:避免频繁跳转导致性能问题 diff --git a/.agents/bak-skills/uniapp-ucharts/examples/integration/pages-config.md b/.agents/bak-skills/uniapp-ucharts/examples/integration/pages-config.md new file mode 100644 index 0000000..560d9a9 --- /dev/null +++ b/.agents/bak-skills/uniapp-ucharts/examples/integration/pages-config.md @@ -0,0 +1,152 @@ +# Pages Configuration + +## pages.json 配置 + +在 UniApp 项目中,`pages.json` 是页面配置文件,需要正确配置以使用 uCharts。 + +### 基本配置 + +```json +{ + "easycom": { + "autoscan": true, + "custom": { + "qiun-data-charts": "@/uni_modules/qiun-data-charts/components/qiun-data-charts/qiun-data-charts.vue" + } + }, + "pages": [ + { + "path": "pages/index/index", + "style": { + "navigationBarTitleText": "首页" + } + } + ], + "globalStyle": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "UniApp", + "navigationBarBackgroundColor": "#ffffff", + "backgroundColor": "#f5f5f5" + } +} +``` + +### 图表页面配置 + +```json +{ + "pages": [ + { + "path": "pages/chart/chart", + "style": { + "navigationBarTitleText": "图表", + "navigationBarBackgroundColor": "#409EFF", + "navigationBarTextStyle": "white", + "backgroundColor": "#f5f5f5" + } + } + ] +} +``` + +### 下拉刷新配置 + +如果图表页面需要下拉刷新: + +```json +{ + "pages": [ + { + "path": "pages/chart/chart", + "style": { + "navigationBarTitleText": "图表", + "enablePullDownRefresh": true + } + } + ] +} +``` + +页面中处理下拉刷新: + +```vue + + + +``` + +### 完整示例 + +```json +{ + "easycom": { + "autoscan": true, + "custom": { + "qiun-data-charts": "@/uni_modules/qiun-data-charts/components/qiun-data-charts/qiun-data-charts.vue" + } + }, + "pages": [ + { + "path": "pages/index/index", + "style": { + "navigationBarTitleText": "首页" + } + }, + { + "path": "pages/chart/line", + "style": { + "navigationBarTitleText": "折线图" + } + }, + { + "path": "pages/chart/bar", + "style": { + "navigationBarTitleText": "柱状图" + } + } + ], + "globalStyle": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "UniApp", + "navigationBarBackgroundColor": "#ffffff", + "backgroundColor": "#f5f5f5" + } +} +``` + +## 注意事项 + +1. **easycom 配置**:必须在 pages.json 中配置 easycom +2. **路径正确性**:确保组件路径正确 +3. **样式配置**:合理配置页面样式 +4. **平台差异**:注意不同平台的配置差异 +5. **性能优化**:合理配置下拉刷新和上拉加载 diff --git a/.agents/bak-skills/uniapp-ucharts/examples/integration/uni-api.md b/.agents/bak-skills/uniapp-ucharts/examples/integration/uni-api.md new file mode 100644 index 0000000..4811208 --- /dev/null +++ b/.agents/bak-skills/uniapp-ucharts/examples/integration/uni-api.md @@ -0,0 +1,246 @@ +# UniApp API Integration + +## UniApp API 与 uCharts 整合 + +在 UniApp 项目中使用 UniApp API 与 uCharts 组件配合使用。 + +### 网络请求 + +#### 使用 uni.request 获取图表数据 + +```javascript +// 获取图表数据 +uni.request({ + url: 'https://api.example.com/chart-data', + method: 'GET', + data: { + type: 'line' + }, + success: (res) => { + this.chartData = res.data + }, + fail: (err) => { + console.error('请求失败', err) + } +}) +``` + +#### 配合 uCharts 使用 + +```vue + + + +``` + +### 存储 API + +#### 缓存图表数据 + +```javascript +// 保存图表数据 +uni.setStorage({ + key: 'chartData', + data: this.chartData, + success: () => { + console.log('保存成功') + } +}) + +// 获取缓存的图表数据 +uni.getStorage({ + key: 'chartData', + success: (res) => { + this.chartData = res.data + } +}) +``` + +### 页面生命周期 + +#### 配合 uCharts 使用 + +```vue + + + +``` + +### 条件编译 + +#### 平台特定 API + +```vue + + + +``` + +### 动态更新图表 + +```vue + + + +``` + +## 注意事项 + +1. **API 兼容性**:注意不同平台 API 的兼容性 +2. **数据格式**:确保数据格式符合 uCharts 要求 +3. **错误处理**:始终处理 API 调用的错误情况 +4. **条件编译**:使用条件编译处理平台差异 +5. **性能优化**:合理使用缓存,避免频繁请求 diff --git a/.agents/bak-skills/uniapp-ucharts/examples/platform-specific/app.md b/.agents/bak-skills/uniapp-ucharts/examples/platform-specific/app.md new file mode 100644 index 0000000..5f1f8a2 --- /dev/null +++ b/.agents/bak-skills/uniapp-ucharts/examples/platform-specific/app.md @@ -0,0 +1,106 @@ +# App Platform + +## App 平台注意事项 + +在 App 平台(iOS/Android)使用 uCharts 时的特殊注意事项。 + +### manifest.json 配置 + +```json +{ + "app-plus": { + "usingComponents": true, + "nvueStyleCompiler": "uni-app", + "splashscreen": { + "alwaysShowBeforeRender": true, + "waiting": true, + "autoclose": true, + "delay": 0 + }, + "distribute": { + "android": { + "permissions": [ + "" + ] + }, + "ios": {} + } + } +} +``` + +### Canvas 支持 + +App 平台支持 Canvas,但 nvue 页面可能有限制。 + +```vue + + + +``` + +### 条件编译 + +使用条件编译处理 App 平台特定逻辑: + +```vue + + + +``` + +### 注意事项 + +1. **Canvas 支持**:App 平台支持 Canvas,但 nvue 可能有限制 +2. **权限配置**:根据功能需求配置相应权限 +3. **性能优化**:App 平台需要注意性能优化 +4. **打包配置**:正确配置打包参数 +5. **版本号**:正确配置版本号和版本名称 diff --git a/.agents/bak-skills/uniapp-ucharts/examples/platform-specific/h5.md b/.agents/bak-skills/uniapp-ucharts/examples/platform-specific/h5.md new file mode 100644 index 0000000..aaf8215 --- /dev/null +++ b/.agents/bak-skills/uniapp-ucharts/examples/platform-specific/h5.md @@ -0,0 +1,126 @@ +# H5 Platform + +## H5 平台注意事项 + +在 H5 平台使用 uCharts 时的特殊注意事项。 + +### manifest.json 配置 + +```json +{ + "h5": { + "router": { + "mode": "hash", + "base": "/" + }, + "devServer": { + "https": false, + "port": 8080 + }, + "publicPath": "/", + "template": "index.html" + } +} +``` + +### Canvas 支持 + +H5 平台完全支持 Canvas,可以使用所有 uCharts 功能。 + +```vue + + + + + +``` + +### 响应式布局 + +H5 平台可以使用媒体查询: + +```vue + +``` + +### 条件编译 + +使用条件编译处理 H5 平台特定逻辑: + +```vue + + + +``` + +### 注意事项 + +1. **Canvas 支持**:H5 平台完全支持 Canvas +2. **性能优化**:H5 平台可以使用更多 Web API 优化性能 +3. **响应式设计**:可以使用媒体查询实现响应式布局 +4. **调试工具**:可以使用浏览器开发者工具调试 +5. **兼容性**:注意不同浏览器的兼容性 diff --git a/.agents/bak-skills/uniapp-ucharts/examples/platform-specific/miniprogram.md b/.agents/bak-skills/uniapp-ucharts/examples/platform-specific/miniprogram.md new file mode 100644 index 0000000..ee15ca1 --- /dev/null +++ b/.agents/bak-skills/uniapp-ucharts/examples/platform-specific/miniprogram.md @@ -0,0 +1,140 @@ +# Mini-Program Platform + +## 小程序平台注意事项 + +在微信小程序等小程序平台使用 uCharts 时的特殊注意事项。 + +### manifest.json 配置 + +```json +{ + "mp-weixin": { + "appid": "your-appid", + "setting": { + "urlCheck": false, + "es6": true, + "enhance": true, + "postcss": true, + "minified": true + }, + "usingComponents": true + } +} +``` + +### Canvas 支持 + +小程序平台支持 Canvas,但需要注意性能限制。 + +```vue + + + + + +``` + +### 条件编译 + +使用条件编译处理小程序平台特定逻辑: + +```vue + + + +``` + +### 性能优化 + +小程序平台需要注意性能: + +```vue + + + +``` + +### 注意事项 + +1. **Canvas 性能**:小程序平台 Canvas 性能有限,注意优化 +2. **数据量**:避免过大的数据量 +3. **代码包大小**:注意小程序代码包大小限制 +4. **AppID 配置**:必须在 manifest.json 中配置正确的 AppID +5. **URL 检查**:开发时可以关闭 urlCheck diff --git a/.agents/bak-skills/uniapp-ucharts/examples/platform-specific/nvue.md b/.agents/bak-skills/uniapp-ucharts/examples/platform-specific/nvue.md new file mode 100644 index 0000000..4cf0e50 --- /dev/null +++ b/.agents/bak-skills/uniapp-ucharts/examples/platform-specific/nvue.md @@ -0,0 +1,91 @@ +# nvue Platform + +## nvue 平台注意事项 + +在 nvue 页面使用 uCharts 时的特殊注意事项。 + +### manifest.json 配置 + +```json +{ + "app-plus": { + "nvueStyleCompiler": "uni-app", + "nvue": { + "flex-direction": "column" + } + } +} +``` + +### Canvas 限制 + +nvue 平台对 Canvas 的支持可能有限,需要注意: + +```vue + + + + + +``` + +### 样式限制 + +nvue 平台样式有限制: + +```vue + +``` + +### 注意事项 + +1. **Canvas 限制**:nvue 平台对 Canvas 的支持可能有限 +2. **样式限制**:nvue 不支持所有 CSS 属性 +3. **条件编译**:使用条件编译处理兼容性问题 +4. **性能**:nvue 性能更好,但功能有限 +5. **替代方案**:考虑使用其他图表方案或条件编译 diff --git a/.agents/bak-skills/uniapp-ucharts/templates/basic-uniapp-project.md b/.agents/bak-skills/uniapp-ucharts/templates/basic-uniapp-project.md new file mode 100644 index 0000000..8e44b80 --- /dev/null +++ b/.agents/bak-skills/uniapp-ucharts/templates/basic-uniapp-project.md @@ -0,0 +1,206 @@ +# Basic UniApp Project Template + +## 基础 UniApp 项目模板 + +这是一个基础的 UniApp + uCharts 项目模板。 + +### 项目结构 + +``` +uniapp-ucharts-project/ +├── uni_modules/ +│ └── qiun-data-charts/ # uCharts 插件 +├── pages/ +│ ├── index/ +│ │ └── index.vue +│ └── ... +├── static/ # 静态资源 +├── App.vue # 应用入口 +├── main.js # 主入口文件 +├── pages.json # 页面配置 +├── manifest.json # 应用配置 +└── uni.scss # 全局样式变量 +``` + +### App.vue + +```vue + + + + + +``` + +### main.js + +```javascript +import App from './App' + +// #ifdef VUE3 +import { createSSRApp } from 'vue' +export function createApp() { + const app = createSSRApp(App) + return { + app + } +} +// #endif + +// #ifndef VUE3 +import Vue from 'vue' +Vue.config.productionTip = false +App.mpType = 'app' +const app = new Vue({ + ...App +}) +app.$mount() +// #endif +``` + +### pages.json + +```json +{ + "easycom": { + "autoscan": true, + "custom": { + "qiun-data-charts": "@/uni_modules/qiun-data-charts/components/qiun-data-charts/qiun-data-charts.vue" + } + }, + "pages": [ + { + "path": "pages/index/index", + "style": { + "navigationBarTitleText": "首页" + } + } + ], + "globalStyle": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "UniApp", + "navigationBarBackgroundColor": "#ffffff", + "backgroundColor": "#f5f5f5" + } +} +``` + +### uni.scss + +```scss +/* uni.scss */ +/* 自定义全局变量 */ +$uni-color-primary: #409EFF; +$uni-bg-color: #f5f5f5; +``` + +### manifest.json + +```json +{ + "name": "uniapp-ucharts-project", + "appid": "", + "versionName": "1.0.0", + "versionCode": "100", + "transformPx": false, + "app-plus": { + "usingComponents": true + }, + "h5": { + "router": { + "mode": "hash" + } + }, + "mp-weixin": { + "appid": "", + "setting": { + "urlCheck": false + }, + "usingComponents": true + } +} +``` + +### pages/index/index.vue + +```vue + + + + + +``` diff --git a/.agents/bak-skills/uniapp-ucharts/templates/manifest-template.md b/.agents/bak-skills/uniapp-ucharts/templates/manifest-template.md new file mode 100644 index 0000000..fe00b44 --- /dev/null +++ b/.agents/bak-skills/uniapp-ucharts/templates/manifest-template.md @@ -0,0 +1,86 @@ +# Manifest Configuration Template + +## manifest.json 配置模板 + +UniApp + uCharts 项目的 manifest.json 配置模板。 + +### 完整模板 + +```json +{ + "name": "uniapp-ucharts-project", + "appid": "", + "description": "UniApp + uCharts 项目", + "versionName": "1.0.0", + "versionCode": "100", + "transformPx": false, + "app-plus": { + "usingComponents": true, + "nvueStyleCompiler": "uni-app", + "splashscreen": { + "alwaysShowBeforeRender": true, + "waiting": true, + "autoclose": true, + "delay": 0 + }, + "distribute": { + "android": { + "permissions": [ + "" + ] + }, + "ios": {} + } + }, + "h5": { + "router": { + "mode": "hash", + "base": "/" + }, + "devServer": { + "https": false, + "port": 8080 + }, + "publicPath": "/", + "template": "index.html" + }, + "mp-weixin": { + "appid": "", + "setting": { + "urlCheck": false, + "es6": true, + "enhance": true, + "postcss": true, + "minified": true + }, + "usingComponents": true, + "permission": { + "scope.userLocation": { + "desc": "你的位置信息将用于小程序位置接口的效果展示" + } + } + }, + "mp-alipay": { + "usingComponents": true + }, + "mp-baidu": { + "usingComponents": true + }, + "mp-toutiao": { + "usingComponents": true + }, + "mp-qq": { + "usingComponents": true + }, + "quickapp": {}, + "vueVersion": "2" +} +``` + +### 使用说明 + +1. **appid**:小程序平台需要配置对应的 AppID +2. **usingComponents**:所有平台都需要设置为 true +3. **transformPx**:建议设置为 false,使用 rpx +4. **vueVersion**:指定 Vue 版本(2 或 3) +5. **平台配置**:根据目标平台配置相应参数 diff --git a/.agents/bak-skills/uniapp-ucharts/templates/pages-template.md b/.agents/bak-skills/uniapp-ucharts/templates/pages-template.md new file mode 100644 index 0000000..59d8d55 --- /dev/null +++ b/.agents/bak-skills/uniapp-ucharts/templates/pages-template.md @@ -0,0 +1,74 @@ +# Pages Configuration Template + +## pages.json 配置模板 + +UniApp + uCharts 项目的 pages.json 配置模板。 + +### 完整模板 + +```json +{ + "easycom": { + "autoscan": true, + "custom": { + "qiun-data-charts": "@/uni_modules/qiun-data-charts/components/qiun-data-charts/qiun-data-charts.vue" + } + }, + "pages": [ + { + "path": "pages/index/index", + "style": { + "navigationBarTitleText": "首页", + "navigationBarBackgroundColor": "#409EFF", + "navigationBarTextStyle": "white" + } + }, + { + "path": "pages/chart/line", + "style": { + "navigationBarTitleText": "折线图", + "enablePullDownRefresh": true + } + }, + { + "path": "pages/chart/bar", + "style": { + "navigationBarTitleText": "柱状图" + } + } + ], + "globalStyle": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "UniApp", + "navigationBarBackgroundColor": "#ffffff", + "backgroundColor": "#f5f5f5" + }, + "tabBar": { + "color": "#7A7E83", + "selectedColor": "#409EFF", + "borderStyle": "black", + "backgroundColor": "#ffffff", + "list": [ + { + "pagePath": "pages/index/index", + "text": "首页", + "iconPath": "static/tab-home.png", + "selectedIconPath": "static/tab-home-current.png" + }, + { + "pagePath": "pages/chart/chart", + "text": "图表", + "iconPath": "static/tab-chart.png", + "selectedIconPath": "static/tab-chart-current.png" + } + ] + } +} +``` + +### 使用说明 + +1. **easycom 配置**:必须配置,用于自动引入 uCharts 组件 +2. **pages 配置**:配置所有页面路径和样式 +3. **globalStyle**:配置全局样式 +4. **tabBar**:配置底部导航栏(可选) diff --git a/.agents/bak-skills/uniapp-uview/SKILL.md b/.agents/bak-skills/uniapp-uview/SKILL.md new file mode 100644 index 0000000..673256d --- /dev/null +++ b/.agents/bak-skills/uniapp-uview/SKILL.md @@ -0,0 +1,156 @@ +--- +name: uniapp-uview +description: A comprehensive skill for integrating and using uView UI with UniApp projects. This skill focuses on UniApp-specific integration, configuration, and platform-specific considerations when using uView UI in UniApp applications. Use this skill whenever the user needs to integrate uView UI into UniApp projects, configure UniApp-specific settings, or handle platform differences. +license: Complete terms in LICENSE.txt +--- + +## When to use this skill + +Use this skill whenever the user wants to: +- Integrate uView UI into UniApp projects +- Configure UniApp projects to work with uView UI (pages.json, manifest.json, easycom) +- Handle platform-specific behaviors when using uView in UniApp (H5, mini-program, App, nvue) +- Use UniApp features (navigation, APIs, lifecycle) with uView components +- Build cross-platform UniApp applications with uView UI components +- Configure easycom for automatic uView component import in UniApp +- Handle navigation and routing with uView in UniApp +- Optimize UniApp projects using uView UI +- Deploy uView-based UniApp applications to multiple platforms + +## How to use this skill + +This skill is organized to match UniApp integration patterns and the official UniApp plugin structure (https://ext.dcloud.net.cn/plugin?id=1593). When working with uView UI in UniApp: + +1. **Install and setup** uView UI in UniApp project: + - Load `examples/getting-started/installation.md` for installation in UniApp + - Load `examples/getting-started/project-setup.md` for UniApp project configuration + - Load `examples/getting-started/easycom-config.md` for easycom configuration + +2. **Integrate with UniApp features**: + - Load `examples/integration/pages-config.md` for pages.json configuration + - Load `examples/integration/manifest-config.md` for manifest.json configuration + - Load `examples/integration/navigation.md` for navigation with uView + - Load `examples/integration/uni-api.md` for using UniApp APIs with uView + +3. **Handle platform-specific behaviors**: + - Load `examples/platform-specific/h5.md` for H5 platform considerations + - Load `examples/platform-specific/miniprogram.md` for mini-program considerations + - Load `examples/platform-specific/app.md` for App platform considerations + - Load `examples/platform-specific/nvue.md` for nvue considerations + +4. **Advanced integration**: + - Load `examples/advanced/custom-theme.md` for theme customization in UniApp + - Load `examples/advanced/build-optimization.md` for build optimization + - Load `examples/advanced/multi-platform.md` for multi-platform deployment + +5. **Reference the API documentation** when needed: + - `api/integration-api.md` - UniApp and uView integration API + - `api/config-api.md` - Configuration API reference + +6. **Use templates** for quick start: + - `templates/basic-uniapp-project.md` - Basic UniApp project with uView + - `templates/pages-template.md` - Pages configuration template + - `templates/manifest-template.md` - Manifest configuration template + +**Important Notes**: +- This skill focuses on UniApp integration, not uView UI API documentation +- uView UI supports both Vue 2 and Vue 3, use appropriate syntax +- Always configure easycom in pages.json for automatic component import +- Use conditional compilation (`#ifdef`, `#endif`) for platform-specific code +- Test on all target platforms (H5, mini-programs, App) before deployment +- Use rpx units for responsive sizing in UniApp + +## Examples and Templates + +### Getting Started +- **Installation**: `examples/getting-started/installation.md` - How to install uView UI in UniApp projects +- **Project Setup**: `examples/getting-started/project-setup.md` - Setting up UniApp project with uView +- **Easycom Config**: `examples/getting-started/easycom-config.md` - Configuring easycom for automatic component import + +### Integration +- **Pages Config**: `examples/integration/pages-config.md` - Configuring pages.json with uView +- **Manifest Config**: `examples/integration/manifest-config.md` - Configuring manifest.json for uView +- **Navigation**: `examples/integration/navigation.md` - Navigation and routing with uView +- **UniApp API**: `examples/integration/uni-api.md` - Using UniApp APIs with uView components + +### Platform-Specific +- **H5**: `examples/platform-specific/h5.md` - H5 platform considerations with uView +- **Mini-Program**: `examples/platform-specific/miniprogram.md` - Mini-program considerations with uView +- **App**: `examples/platform-specific/app.md` - App platform considerations with uView +- **nvue**: `examples/platform-specific/nvue.md` - nvue considerations with uView + +### Advanced +- **Custom Theme**: `examples/advanced/custom-theme.md` - Customizing themes in UniApp projects +- **Build Optimization**: `examples/advanced/build-optimization.md` - Optimizing UniApp builds with uView +- **Multi-Platform**: `examples/advanced/multi-platform.md` - Multi-platform deployment strategies + +### Templates +- **Basic Project**: `templates/basic-uniapp-project.md` - Basic UniApp project structure with uView +- **Pages Template**: `templates/pages-template.md` - pages.json configuration template +- **Manifest Template**: `templates/manifest-template.md` - manifest.json configuration template + +## API Reference + +- **Integration API**: `api/integration-api.md` - UniApp and uView integration API reference +- **Config API**: `api/config-api.md` - Configuration API reference for UniApp projects + +## Best Practices + +1. **Use easycom**: Configure easycom in pages.json for automatic uView component import +2. **Platform Testing**: Test on all target platforms (H5, mini-programs, App) +3. **Use rpx Units**: Use rpx for responsive sizing in UniApp, px for fixed sizes +4. **SCSS Support**: Ensure SCSS is properly configured in UniApp project +5. **Manifest Configuration**: Properly configure manifest.json for each platform +6. **Conditional Compilation**: Use conditional compilation for platform-specific code +7. **Performance**: Optimize for each platform's specific requirements +8. **Navigation**: Use UniApp navigation API with uView components + +## Resources + +- **Official Plugin**: https://ext.dcloud.net.cn/plugin?id=1593 +- **UniApp Documentation**: https://uniapp.dcloud.net.cn/ +- **uView UI**: https://www.uviewui.com/ + +## Keywords + +uniapp, uview, uview-ui, uniapp integration, uniapp configuration, easycom, pages.json, manifest.json, uni-app, 小程序, 跨平台, H5, App, nvue, 条件编译, 平台差异 + +## 能力边界 + +### ✅ 适用场景 +- 当你需要使用此技能对应的技术栈时 +- 当项目需要遵循最佳实践时 +- 当需要快速上手或深入理解核心概念时 + +### ⚠️ 需要注意 +- 复杂业务逻辑需要结合具体场景调整 +- 性能优化需要根据实际数据量评估 + +### ❌ 不适用场景 +- 不相关的技术栈或框架 +- 需要完全自定义的特殊场景 + +## 常见陷阱 (Gotchas) + +1. **版本兼容性**:注意框架版本与依赖库的兼容性,不同版本 API 可能有差异 +2. **配置文件格式**:配置文件格式错误是最常见的问题,建议使用编辑器的语法检查 +3. **环境变量**:确保所有必要的环境变量已正确设置,敏感信息不要硬编码 +4. **依赖冲突**:多版本共存时注意依赖冲突,使用 lock 文件锁定版本 +5. **性能陷阱**:大数据量场景下注意性能优化,避免 N+1 查询等常见问题 + +## 使用流程 + +### Step 1: 环境准备 +确保开发环境已安装必要的依赖和工具。 + +### Step 2: 配置初始化 +根据项目需求进行基础配置。 + +### Step 3: 核心功能使用 +按照示例代码实现核心功能。 + +### Step 4: 测试验证 +运行测试确保功能正常。 + +### Step 5: 部署上线 +完成开发后进行部署和监控。 diff --git a/.agents/bak-skills/uniapp-uview/api/config-api.md b/.agents/bak-skills/uniapp-uview/api/config-api.md new file mode 100644 index 0000000..6ba7fce --- /dev/null +++ b/.agents/bak-skills/uniapp-uview/api/config-api.md @@ -0,0 +1,187 @@ +# Configuration API + +## 配置 API + +UniApp + uView 项目的配置文件 API 参考。 + +### pages.json 配置 + +#### easycom 配置 + +```json +{ + "easycom": { + "autoscan": true, + "custom": { + "^u-(.*)": "uview-ui/components/u-$1/u-$1.vue" + } + } +} +``` + +#### pages 配置 + +```json +{ + "pages": [ + { + "path": "pages/index/index", + "style": { + "navigationBarTitleText": "首页", + "navigationStyle": "default" | "custom", + "navigationBarBackgroundColor": "#ffffff", + "navigationBarTextStyle": "black" | "white", + "backgroundColor": "#f5f5f5", + "enablePullDownRefresh": true, + "onReachBottomDistance": 50 + } + } + ] +} +``` + +#### globalStyle 配置 + +```json +{ + "globalStyle": { + "navigationBarTextStyle": "black" | "white", + "navigationBarTitleText": "UniApp", + "navigationBarBackgroundColor": "#ffffff", + "backgroundColor": "#f5f5f5" + } +} +``` + +#### tabBar 配置 + +```json +{ + "tabBar": { + "color": "#7A7E83", + "selectedColor": "#409EFF", + "borderStyle": "black" | "white", + "backgroundColor": "#ffffff", + "list": [ + { + "pagePath": "pages/index/index", + "text": "首页", + "iconPath": "static/tab-home.png", + "selectedIconPath": "static/tab-home-current.png" + } + ] + } +} +``` + +### manifest.json 配置 + +#### 基本配置 + +```json +{ + "name": "uniapp-uview-project", + "appid": "", + "versionName": "1.0.0", + "versionCode": "100", + "transformPx": false +} +``` + +#### H5 配置 + +```json +{ + "h5": { + "router": { + "mode": "hash" | "history", + "base": "/" + }, + "devServer": { + "https": false, + "port": 8080 + } + } +} +``` + +#### 微信小程序配置 + +```json +{ + "mp-weixin": { + "appid": "your-appid", + "setting": { + "urlCheck": false, + "es6": true, + "enhance": true, + "postcss": true, + "minified": true + }, + "usingComponents": true + } +} +``` + +#### App 配置 + +```json +{ + "app-plus": { + "usingComponents": true, + "nvueStyleCompiler": "uni-app", + "distribute": { + "android": { + "permissions": [] + }, + "ios": {} + } + } +} +``` + +### uni.scss 配置 + +```scss +/* 引入 uView 主题变量 */ +@import "uview-ui/theme.scss"; + +/* 自定义变量 */ +$uni-color-primary: #409EFF; +$uni-bg-color: #f5f5f5; +``` + +### App.vue 配置 + +```vue + +``` + +### main.js 配置 + +#### Vue 2 + +```javascript +import Vue from 'vue' +import App from './App' +import uView from 'uview-ui' + +Vue.use(uView) +``` + +#### Vue 3 + +```javascript +import { createSSRApp } from 'vue' +import App from './App' +import uView from 'uview-ui' + +export function createApp() { + const app = createSSRApp(App) + app.use(uView) + return { app } +} +``` diff --git a/.agents/bak-skills/uniapp-uview/api/integration-api.md b/.agents/bak-skills/uniapp-uview/api/integration-api.md new file mode 100644 index 0000000..4df571b --- /dev/null +++ b/.agents/bak-skills/uniapp-uview/api/integration-api.md @@ -0,0 +1,179 @@ +# Integration API + +## UniApp 与 uView 整合 API + +UniApp 与 uView UI 整合使用的 API 参考。 + +### easycom 配置 API + +```json +{ + "easycom": { + "autoscan": boolean, + "custom": { + "^u-(.*)": "uview-ui/components/u-$1/u-$1.vue" + } + } +} +``` + +### pages.json API + +```json +{ + "pages": [ + { + "path": "string", + "style": { + "navigationBarTitleText": "string", + "navigationStyle": "default" | "custom", + "navigationBarBackgroundColor": "string", + "navigationBarTextStyle": "black" | "white", + "enablePullDownRefresh": boolean, + "onReachBottomDistance": number + } + } + ], + "globalStyle": { + "navigationBarTextStyle": "black" | "white", + "navigationBarTitleText": "string", + "navigationBarBackgroundColor": "string", + "backgroundColor": "string" + }, + "tabBar": { + "color": "string", + "selectedColor": "string", + "borderStyle": "black" | "white", + "backgroundColor": "string", + "list": [ + { + "pagePath": "string", + "text": "string", + "iconPath": "string", + "selectedIconPath": "string" + } + ] + } +} +``` + +### manifest.json API + +```json +{ + "name": "string", + "appid": "string", + "versionName": "string", + "versionCode": "string", + "transformPx": boolean, + "app-plus": { + "usingComponents": boolean, + "nvueStyleCompiler": "uni-app" | "weex" + }, + "h5": { + "router": { + "mode": "hash" | "history", + "base": "string" + } + }, + "mp-weixin": { + "appid": "string", + "setting": { + "urlCheck": boolean, + "es6": boolean, + "enhance": boolean, + "postcss": boolean, + "minified": boolean + }, + "usingComponents": boolean + } +} +``` + +### UniApp API 与 uView 配合 + +#### 导航 API + +```javascript +// 页面跳转 +uni.navigateTo({ + url: 'string', + success: function, + fail: function, + complete: function +}) + +// 页面返回 +uni.navigateBack({ + delta: number +}) + +// TabBar 跳转 +uni.switchTab({ + url: 'string' +}) +``` + +#### 网络请求 API + +```javascript +uni.request({ + url: 'string', + method: 'GET' | 'POST' | 'PUT' | 'DELETE', + data: object, + header: object, + success: function, + fail: function, + complete: function +}) +``` + +#### 存储 API + +```javascript +// 存储数据 +uni.setStorage({ + key: 'string', + data: any, + success: function, + fail: function +}) + +// 获取数据 +uni.getStorage({ + key: 'string', + success: function, + fail: function +}) + +// 移除数据 +uni.removeStorage({ + key: 'string', + success: function, + fail: function +}) +``` + +### 条件编译 API + +```javascript +// #ifdef 平台名称 +// 平台特定代码 +// #endif + +// #ifndef 平台名称 +// 非平台特定代码 +// #endif + +// #ifdef H5 +// H5 平台代码 +// #endif + +// #ifdef MP-WEIXIN +// 微信小程序代码 +// #endif + +// #ifdef APP-PLUS +// App 平台代码 +// #endif +``` diff --git a/.agents/bak-skills/uniapp-uview/examples/advanced/build-optimization.md b/.agents/bak-skills/uniapp-uview/examples/advanced/build-optimization.md new file mode 100644 index 0000000..af89af4 --- /dev/null +++ b/.agents/bak-skills/uniapp-uview/examples/advanced/build-optimization.md @@ -0,0 +1,97 @@ +# Build Optimization + +## 构建优化 + +优化 UniApp + uView 项目的构建和性能。 + +### 代码分割 + +使用条件编译减少代码体积: + +```vue + +``` + +### 组件按需引入 + +虽然 easycom 会自动引入,但可以优化: + +```json +{ + "easycom": { + "autoscan": true, + "custom": { + "^u-(.*)": "uview-ui/components/u-$1/u-$1.vue" + } + } +} +``` + +### 图片优化 + +```vue + +``` + +### 样式优化 + +```vue + +``` + +### 打包配置 + +在 manifest.json 中配置打包选项: + +```json +{ + "mp-weixin": { + "setting": { + "minified": true, + "postcss": true + } + }, + "h5": { + "optimization": { + "treeShaking": { + "enable": true + } + } + } +} +``` + +### 注意事项 + +1. **条件编译**:使用条件编译减少代码体积 +2. **图片优化**:使用合适的图片格式和大小 +3. **样式优化**:使用 scoped 避免样式污染 +4. **打包配置**:正确配置打包选项 +5. **性能测试**:在不同平台测试性能 diff --git a/.agents/bak-skills/uniapp-uview/examples/advanced/custom-theme.md b/.agents/bak-skills/uniapp-uview/examples/advanced/custom-theme.md new file mode 100644 index 0000000..49828e7 --- /dev/null +++ b/.agents/bak-skills/uniapp-uview/examples/advanced/custom-theme.md @@ -0,0 +1,96 @@ +# Custom Theme + +## 自定义主题 + +在 UniApp 项目中自定义 uView UI 主题。 + +### 修改主题变量 + +在 `uni.scss` 中修改主题变量: + +```scss +/* uni.scss */ +@import "uview-ui/theme.scss"; + +/* 自定义主题变量 */ +$u-type-primary: #409EFF; +$u-type-success: #67C23A; +$u-type-warning: #E6A23C; +$u-type-error: #F56C6C; +$u-type-info: #909399; + +/* 自定义其他变量 */ +$u-main-color: #303133; +$u-content-color: #606266; +$u-tips-color: #909399; +$u-light-color: #C0C4CC; +$u-border-color: #E4E7ED; +$u-bg-color: #F3F4F6; +``` + +### 使用 SCSS 变量 + +在组件中使用主题变量: + +```vue + + + +``` + +### 全局样式覆盖 + +在 `App.vue` 中覆盖全局样式: + +```vue + +``` + +### 条件编译主题 + +不同平台可以使用不同主题: + +```scss +/* uni.scss */ +@import "uview-ui/theme.scss"; + +/* #ifdef H5 */ +$u-type-primary: #409EFF; +/* #endif */ + +/* #ifdef MP-WEIXIN */ +$u-type-primary: #07c160; +/* #endif */ + +/* #ifdef APP-PLUS */ +$u-type-primary: #007AFF; +/* #endif */ +``` + +### 注意事项 + +1. **变量名称**:使用正确的变量名称 +2. **引入顺序**:先引入 uView 主题,再覆盖变量 +3. **作用域**:注意变量的作用域 +4. **平台差异**:使用条件编译处理平台差异 +5. **测试验证**:在不同平台测试主题效果 diff --git a/.agents/bak-skills/uniapp-uview/examples/advanced/multi-platform.md b/.agents/bak-skills/uniapp-uview/examples/advanced/multi-platform.md new file mode 100644 index 0000000..352d0f3 --- /dev/null +++ b/.agents/bak-skills/uniapp-uview/examples/advanced/multi-platform.md @@ -0,0 +1,97 @@ +# Multi-Platform Deployment + +## 多平台部署 + +UniApp + uView 项目支持多平台部署的策略和注意事项。 + +### 平台差异处理 + +使用条件编译处理平台差异: + +```vue + + + +``` + +### 统一 API 封装 + +封装统一的 API 调用: + +```javascript +// utils/api.js +export function request(url, options = {}) { + return new Promise((resolve, reject) => { + uni.request({ + url, + ...options, + success: (res) => { + resolve(res.data) + }, + fail: (err) => { + reject(err) + } + }) + }) +} +``` + +### 平台特定配置 + +在 manifest.json 中配置各平台: + +```json +{ + "h5": { + "router": { + "mode": "hash" + } + }, + "mp-weixin": { + "appid": "your-appid" + }, + "app-plus": { + "usingComponents": true + } +} +``` + +### 注意事项 + +1. **条件编译**:使用条件编译处理平台差异 +2. **API 统一**:封装统一的 API 调用 +3. **配置管理**:正确配置各平台参数 +4. **测试验证**:在各平台测试功能 +5. **文档记录**:记录平台差异和注意事项 diff --git a/.agents/bak-skills/uniapp-uview/examples/getting-started/easycom-config.md b/.agents/bak-skills/uniapp-uview/examples/getting-started/easycom-config.md new file mode 100644 index 0000000..5666ee1 --- /dev/null +++ b/.agents/bak-skills/uniapp-uview/examples/getting-started/easycom-config.md @@ -0,0 +1,170 @@ +# Easycom Configuration + +## Easycom 配置 + +easycom 是 UniApp 的自动引入机制,配置后可以自动引入 uView 组件,无需手动 import。 + +### 基本配置 + +在 `pages.json` 中配置 easycom: + +```json +{ + "easycom": { + "autoscan": true, + "custom": { + "^u-(.*)": "uview-ui/components/u-$1/u-$1.vue" + } + } +} +``` + +### 配置说明 + +- `autoscan: true`:开启自动扫描 +- `custom`:自定义规则 +- `^u-(.*)`:匹配以 `u-` 开头的组件名 +- `uview-ui/components/u-$1/u-$1.vue`:组件路径,`$1` 是匹配的内容 + +### 使用示例 + +配置后,可以直接使用组件,无需引入: + +```vue + + + +``` + +### 完整 pages.json 示例 + +```json +{ + "easycom": { + "autoscan": true, + "custom": { + "^u-(.*)": "uview-ui/components/u-$1/u-$1.vue" + } + }, + "pages": [ + { + "path": "pages/index/index", + "style": { + "navigationBarTitleText": "首页" + } + } + ], + "globalStyle": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "UniApp", + "navigationBarBackgroundColor": "#ffffff", + "backgroundColor": "#f5f5f5" + } +} +``` + +### 自定义组件路径 + +如果 uView 安装在不同位置,需要调整路径: + +#### npm 安装 + +```json +{ + "easycom": { + "autoscan": true, + "custom": { + "^u-(.*)": "node_modules/uview-ui/components/u-$1/u-$1.vue" + } + } +} +``` + +#### uni_modules 安装 + +```json +{ + "easycom": { + "autoscan": true, + "custom": { + "^u-(.*)": "uni_modules/uview-ui/components/u-$1/u-$1.vue" + } + } +} +``` + +### 禁用 easycom + +如果不想使用 easycom,可以手动引入: + +```vue + + + +``` + +### 验证配置 + +创建测试页面验证 easycom 是否生效: + +```vue + + + +``` + +如果按钮正常显示且无报错,说明 easycom 配置成功。 + +## 注意事项 + +1. **路径必须正确**:确保组件路径与实际安装位置一致 +2. **组件名称**:uView 组件都以 `u-` 开头 +3. **重启项目**:修改 easycom 配置后需要重启项目 +4. **优先级**:easycom 优先级高于手动引入 +5. **性能**:easycom 不会影响性能,按需加载组件 diff --git a/.agents/bak-skills/uniapp-uview/examples/getting-started/installation.md b/.agents/bak-skills/uniapp-uview/examples/getting-started/installation.md new file mode 100644 index 0000000..2d4bd42 --- /dev/null +++ b/.agents/bak-skills/uniapp-uview/examples/getting-started/installation.md @@ -0,0 +1,171 @@ +# Installation + +## 在 UniApp 项目中安装 uView UI + +uView UI 是专为 UniApp 设计的 UI 组件库,需要正确集成到 UniApp 项目中。 + +### 方式一:通过 DCloud 插件市场安装(推荐) + +1. 访问 DCloud 插件市场:https://ext.dcloud.net.cn/plugin?id=1593 +2. 在 HBuilderX 中: + - 打开项目 + - 点击"工具" → "插件安装" + - 搜索 "uView UI" 或直接输入插件 ID: 1593 + - 点击"导入插件" +3. 插件会自动导入到 `uni_modules/uview-ui` 目录 + +### 方式二:通过 npm 安装 + +```bash +npm install uview-ui +``` + +安装后,uView UI 位于 `node_modules/uview-ui` 目录。 + +### 方式三:手动下载安装 + +1. 从 GitHub 下载:https://github.com/umicro/uView +2. 将下载的文件解压到项目的 `uni_modules/uview-ui` 目录 + +## UniApp 项目配置 + +### 1. 在 main.js 中引入 + +```javascript +// main.js +import App from './App' +import uView from 'uview-ui' + +// #ifdef VUE3 +import { createSSRApp } from 'vue' +export function createApp() { + const app = createSSRApp(App) + app.use(uView) + return { + app + } +} +// #endif + +// #ifndef VUE3 +import Vue from 'vue' +Vue.use(uView) +Vue.config.productionTip = false +App.mpType = 'app' +const app = new Vue({ + ...App +}) +app.$mount() +// #endif +``` + +### 2. 在 App.vue 中引入样式 + +```vue + + +``` + +### 3. 在 uni.scss 中引入主题变量(可选) + +```scss +/* uni.scss */ +@import "uview-ui/theme.scss"; +``` + +### 4. 配置 easycom(重要) + +在 `pages.json` 中配置 easycom,实现组件自动引入: + +```json +{ + "easycom": { + "autoscan": true, + "custom": { + "^u-(.*)": "uview-ui/components/u-$1/u-$1.vue" + } + }, + "pages": [ + // ... 页面配置 + ] +} +``` + +### 5. 验证安装 + +创建测试页面 `pages/index/index.vue`: + +```vue + + + + + +``` + +如果按钮正常显示,说明安装成功。 + +## 目录结构 + +安装后的项目结构: + +``` +uniapp-project/ +├── uni_modules/ +│ └── uview-ui/ # uView UI 插件 +│ ├── components/ # 组件目录 +│ ├── index.scss # 基础样式 +│ └── theme.scss # 主题变量 +├── pages/ # 页面目录 +├── static/ # 静态资源 +├── App.vue # 应用入口 +├── main.js # 主入口文件 +├── pages.json # 页面配置 +├── manifest.json # 应用配置 +└── uni.scss # 全局样式变量 +``` + +## 注意事项 + +1. **SCSS 支持**:确保项目支持 SCSS,在 HBuilderX 中创建项目时选择支持 SCSS +2. **easycom 配置**:必须配置 easycom,否则需要手动引入每个组件 +3. **路径问题**:如果使用 npm 安装,注意路径可能需要调整 +4. **版本兼容**:确保 uView UI 版本与 UniApp 版本兼容 +5. **Vue 版本**:uView UI 支持 Vue 2 和 Vue 3,注意对应的使用方式 + +## 常见问题 + +### 组件找不到 + +- 检查 easycom 配置是否正确 +- 检查组件名称是否正确(u-button, u-input 等) +- 检查是否在 main.js 中注册了 uView + +### 样式不生效 + +- 检查是否在 App.vue 中引入了 `uview-ui/index.scss` +- 检查 style 标签是否设置了 `lang="scss"` +- 检查项目是否支持 SCSS + +### 主题变量不生效 + +- 检查是否在 uni.scss 中引入了 `uview-ui/theme.scss` +- 检查变量名称是否正确 +- 检查 SCSS 语法是否正确 diff --git a/.agents/bak-skills/uniapp-uview/examples/getting-started/project-setup.md b/.agents/bak-skills/uniapp-uview/examples/getting-started/project-setup.md new file mode 100644 index 0000000..be4278a --- /dev/null +++ b/.agents/bak-skills/uniapp-uview/examples/getting-started/project-setup.md @@ -0,0 +1,264 @@ +# Project Setup + +## UniApp 项目配置 + +配置 UniApp 项目以正确使用 uView UI。 + +### 项目结构 + +标准的 UniApp + uView 项目结构: + +``` +uniapp-project/ +├── uni_modules/ +│ └── uview-ui/ # uView UI 插件 +├── pages/ # 页面目录 +│ ├── index/ +│ │ └── index.vue +│ └── ... +├── components/ # 自定义组件 +├── static/ # 静态资源 +├── utils/ # 工具函数 +├── App.vue # 应用入口 +├── main.js # 主入口文件 +├── pages.json # 页面配置 +├── manifest.json # 应用配置 +└── uni.scss # 全局样式变量 +``` + +### App.vue 配置 + +```vue + + + + + +``` + +### main.js 配置 + +#### Vue 2 项目 + +```javascript +import Vue from 'vue' +import App from './App' +import uView from 'uview-ui' + +Vue.use(uView) + +Vue.config.productionTip = false + +App.mpType = 'app' + +const app = new Vue({ + ...App +}) +app.$mount() +``` + +#### Vue 3 项目 + +```javascript +import { createSSRApp } from 'vue' +import App from './App' +import uView from 'uview-ui' + +export function createApp() { + const app = createSSRApp(App) + app.use(uView) + return { + app + } +} +``` + +### pages.json 配置 + +```json +{ + "easycom": { + "autoscan": true, + "custom": { + "^u-(.*)": "uview-ui/components/u-$1/u-$1.vue" + } + }, + "pages": [ + { + "path": "pages/index/index", + "style": { + "navigationBarTitleText": "首页", + "navigationStyle": "default", + "navigationBarBackgroundColor": "#ffffff", + "navigationBarTextStyle": "black" + } + } + ], + "globalStyle": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "UniApp", + "navigationBarBackgroundColor": "#ffffff", + "backgroundColor": "#f5f5f5" + }, + "tabBar": { + "color": "#7A7E83", + "selectedColor": "#3cc51f", + "borderStyle": "black", + "backgroundColor": "#ffffff", + "list": [ + { + "pagePath": "pages/index/index", + "iconPath": "static/tab-home.png", + "selectedIconPath": "static/tab-home-current.png", + "text": "首页" + } + ] + } +} +``` + +### uni.scss 配置 + +```scss +/* uni.scss */ +/* 引入 uView 主题变量 */ +@import "uview-ui/theme.scss"; + +/* 自定义全局变量 */ +$uni-color-primary: #409EFF; +$uni-bg-color: #f5f5f5; +``` + +### manifest.json 配置要点 + +```json +{ + "name": "uniapp-uview-project", + "appid": "", + "description": "", + "versionName": "1.0.0", + "versionCode": "100", + "transformPx": false, + "app-plus": { + "usingComponents": true + }, + "h5": { + "router": { + "mode": "hash" + } + }, + "mp-weixin": { + "appid": "", + "setting": { + "urlCheck": false + }, + "usingComponents": true + } +} +``` + +## 开发环境配置 + +### HBuilderX 配置 + +1. **启用 SCSS 支持**: + - 创建项目时选择支持 SCSS + - 或在项目设置中启用 SCSS 编译 + +2. **配置编译器**: + - 工具 → 选项 → HBuilderX → 编译器 + - 确保启用 SCSS 编译 + +### 条件编译 + +使用条件编译处理平台差异: + +```vue + +``` + +## 验证配置 + +创建测试页面验证配置是否正确: + +```vue + + + + + +``` + +## 注意事项 + +1. **easycom 必须配置**:否则需要手动引入每个组件 +2. **SCSS 必须支持**:uView 依赖 SCSS +3. **路径正确性**:确保引入路径正确 +4. **版本兼容**:确保 UniApp 和 uView 版本兼容 +5. **平台测试**:在不同平台测试功能 diff --git a/.agents/bak-skills/uniapp-uview/examples/integration/manifest-config.md b/.agents/bak-skills/uniapp-uview/examples/integration/manifest-config.md new file mode 100644 index 0000000..3d7707f --- /dev/null +++ b/.agents/bak-skills/uniapp-uview/examples/integration/manifest-config.md @@ -0,0 +1,216 @@ +# Manifest Configuration + +## manifest.json 配置 + +`manifest.json` 是 UniApp 的应用配置文件,需要正确配置以支持 uView UI 在不同平台运行。 + +### 基本配置 + +```json +{ + "name": "uniapp-uview-project", + "appid": "", + "description": "", + "versionName": "1.0.0", + "versionCode": "100", + "transformPx": false, + "app-plus": { + "usingComponents": true + }, + "h5": { + "router": { + "mode": "hash" + } + }, + "mp-weixin": { + "appid": "", + "setting": { + "urlCheck": false + }, + "usingComponents": true + } +} +``` + +### H5 平台配置 + +```json +{ + "h5": { + "router": { + "mode": "hash", + "base": "/" + }, + "devServer": { + "https": false, + "port": 8080 + }, + "publicPath": "/", + "template": "index.html" + } +} +``` + +### 微信小程序配置 + +```json +{ + "mp-weixin": { + "appid": "your-appid", + "setting": { + "urlCheck": false, + "es6": true, + "enhance": true, + "postcss": true, + "minified": true + }, + "usingComponents": true, + "permission": { + "scope.userLocation": { + "desc": "你的位置信息将用于小程序位置接口的效果展示" + } + } + } +} +``` + +### App 平台配置 + +```json +{ + "app-plus": { + "usingComponents": true, + "nvueStyleCompiler": "uni-app", + "splashscreen": { + "alwaysShowBeforeRender": true, + "waiting": true, + "autoclose": true, + "delay": 0 + }, + "modules": {}, + "distribute": { + "android": { + "permissions": [ + "" + ] + }, + "ios": {}, + "sdkConfigs": {} + } + } +} +``` + +### 支付宝小程序配置 + +```json +{ + "mp-alipay": { + "usingComponents": true + } +} +``` + +### 百度小程序配置 + +```json +{ + "mp-baidu": { + "usingComponents": true + } +} +``` + +### 字节跳动小程序配置 + +```json +{ + "mp-toutiao": { + "usingComponents": true + } +} +``` + +### QQ 小程序配置 + +```json +{ + "mp-qq": { + "usingComponents": true + } +} +``` + +### 完整配置示例 + +```json +{ + "name": "uniapp-uview-project", + "appid": "", + "description": "UniApp + uView UI 项目", + "versionName": "1.0.0", + "versionCode": "100", + "transformPx": false, + "app-plus": { + "usingComponents": true, + "nvueStyleCompiler": "uni-app" + }, + "h5": { + "router": { + "mode": "hash" + }, + "devServer": { + "port": 8080 + } + }, + "mp-weixin": { + "appid": "", + "setting": { + "urlCheck": false, + "es6": true, + "enhance": true, + "postcss": true, + "minified": true + }, + "usingComponents": true + }, + "mp-alipay": { + "usingComponents": true + }, + "mp-baidu": { + "usingComponents": true + }, + "mp-toutiao": { + "usingComponents": true + }, + "mp-qq": { + "usingComponents": true + }, + "quickapp": {}, + "vueVersion": "3" +} +``` + +## 关键配置说明 + +### usingComponents + +所有平台都需要设置 `"usingComponents": true`,以支持组件使用。 + +### transformPx + +建议设置为 `false`,使用 rpx 单位进行响应式布局。 + +### vueVersion + +指定 Vue 版本: +- `"2"` - Vue 2 +- `"3"` - Vue 3 + +## 注意事项 + +1. **usingComponents**:必须设置为 true +2. **平台差异**:不同平台有不同的配置项 +3. **AppID**:小程序平台需要配置对应的 AppID +4. **权限配置**:根据功能需求配置相应权限 +5. **版本号**:正确配置版本号和版本名称 diff --git a/.agents/bak-skills/uniapp-uview/examples/integration/navigation.md b/.agents/bak-skills/uniapp-uview/examples/integration/navigation.md new file mode 100644 index 0000000..6010918 --- /dev/null +++ b/.agents/bak-skills/uniapp-uview/examples/integration/navigation.md @@ -0,0 +1,309 @@ +# Navigation + +## 导航和路由 + +在 UniApp 中使用 uView UI 组件进行页面导航和路由管理。 + +### 使用 UniApp 导航 API + +#### 页面跳转 + +```javascript +// 保留当前页面,跳转到应用内的某个页面 +uni.navigateTo({ + url: '/pages/detail/detail?id=1' +}) + +// 关闭当前页面,跳转到应用内的某个页面 +uni.redirectTo({ + url: '/pages/login/login' +}) + +// 跳转到 tabBar 页面 +uni.switchTab({ + url: '/pages/index/index' +}) + +// 返回上一页面 +uni.navigateBack({ + delta: 1 +}) +``` + +#### 使用 uView 按钮进行跳转 + +```vue + + + +``` + +### 使用 uView 导航栏 + +#### 自定义导航栏 + +```json +{ + "pages": [ + { + "path": "pages/index/index", + "style": { + "navigationStyle": "custom" + } + } + ] +} +``` + +页面中使用 uView 导航栏: + +```vue + + + +``` + +### 使用 uView 返回顶部 + +```vue + + + +``` + +### TabBar 导航 + +#### 使用原生 TabBar + +```json +{ + "tabBar": { + "color": "#7A7E83", + "selectedColor": "#409EFF", + "borderStyle": "black", + "backgroundColor": "#ffffff", + "list": [ + { + "pagePath": "pages/index/index", + "text": "首页" + }, + { + "pagePath": "pages/user/user", + "text": "我的" + } + ] + } +} +``` + +#### 使用 uView TabBar 组件 + +```vue + + + +``` + +### 页面传参 + +#### 传递参数 + +```javascript +// 跳转并传递参数 +uni.navigateTo({ + url: '/pages/detail/detail?id=1&name=test' +}) +``` + +#### 接收参数 + +```vue + + + +``` + +### 使用 uView 搜索框导航 + +```vue + + + +``` + +### 导航栏返回按钮自定义 + +```vue + + + +``` + +## 注意事项 + +1. **路径格式**:路径必须以 `/` 开头 +2. **TabBar 跳转**:使用 `uni.switchTab` 跳转到 tabBar 页面 +3. **参数传递**:URL 参数需要编码 +4. **页面栈**:注意页面栈限制(最多 10 层) +5. **返回按钮**:自定义导航栏需要自己处理返回逻辑 diff --git a/.agents/bak-skills/uniapp-uview/examples/integration/pages-config.md b/.agents/bak-skills/uniapp-uview/examples/integration/pages-config.md new file mode 100644 index 0000000..da662d9 --- /dev/null +++ b/.agents/bak-skills/uniapp-uview/examples/integration/pages-config.md @@ -0,0 +1,263 @@ +# Pages Configuration + +## pages.json 配置 + +在 UniApp 项目中,`pages.json` 是页面配置文件,需要正确配置以使用 uView UI。 + +### 基本配置 + +```json +{ + "easycom": { + "autoscan": true, + "custom": { + "^u-(.*)": "uview-ui/components/u-$1/u-$1.vue" + } + }, + "pages": [ + { + "path": "pages/index/index", + "style": { + "navigationBarTitleText": "首页" + } + } + ], + "globalStyle": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "UniApp", + "navigationBarBackgroundColor": "#ffffff", + "backgroundColor": "#f5f5f5" + } +} +``` + +### 使用 uView 导航栏 + +#### 方式一:使用 uView 导航栏组件 + +```json +{ + "pages": [ + { + "path": "pages/index/index", + "style": { + "navigationStyle": "custom", + "navigationBarTitleText": "首页" + } + } + ] +} +``` + +页面中使用 uView 导航栏: + +```vue + +``` + +#### 方式二:使用原生导航栏 + +```json +{ + "pages": [ + { + "path": "pages/index/index", + "style": { + "navigationBarTitleText": "首页", + "navigationBarBackgroundColor": "#409EFF", + "navigationBarTextStyle": "white" + } + } + ] +} +``` + +### TabBar 配置 + +```json +{ + "tabBar": { + "color": "#7A7E83", + "selectedColor": "#409EFF", + "borderStyle": "black", + "backgroundColor": "#ffffff", + "list": [ + { + "pagePath": "pages/index/index", + "iconPath": "static/tab-home.png", + "selectedIconPath": "static/tab-home-current.png", + "text": "首页" + }, + { + "pagePath": "pages/user/user", + "iconPath": "static/tab-user.png", + "selectedIconPath": "static/tab-user-current.png", + "text": "我的" + } + ] + } +} +``` + +### 使用 uView TabBar 组件 + +如果使用 uView 的 TabBar 组件,可以禁用原生 TabBar: + +```json +{ + "tabBar": { + "custom": true, + "list": [ + { + "pagePath": "pages/index/index", + "text": "首页" + } + ] + } +} +``` + +### 页面样式配置 + +```json +{ + "pages": [ + { + "path": "pages/index/index", + "style": { + "navigationBarTitleText": "首页", + "navigationBarBackgroundColor": "#409EFF", + "navigationBarTextStyle": "white", + "backgroundColor": "#f5f5f5", + "enablePullDownRefresh": true, + "onReachBottomDistance": 50 + } + } + ] +} +``` + +### 下拉刷新配置 + +```json +{ + "pages": [ + { + "path": "pages/list/list", + "style": { + "navigationBarTitleText": "列表", + "enablePullDownRefresh": true + } + } + ] +} +``` + +页面中使用 uView 下拉刷新: + +```vue + + + +``` + +### 条件编译配置 + +不同平台可以有不同的配置: + +```json +{ + "pages": [ + { + "path": "pages/index/index", + "style": { + "navigationBarTitleText": "首页", + "// #ifdef H5": { + "navigationStyle": "custom" + }, + "// #ifdef MP-WEIXIN": { + "navigationBarTitleText": "微信首页" + } + } + } + ] +} +``` + +### 完整示例 + +```json +{ + "easycom": { + "autoscan": true, + "custom": { + "^u-(.*)": "uview-ui/components/u-$1/u-$1.vue" + } + }, + "pages": [ + { + "path": "pages/index/index", + "style": { + "navigationBarTitleText": "首页", + "navigationBarBackgroundColor": "#409EFF", + "navigationBarTextStyle": "white" + } + }, + { + "path": "pages/list/list", + "style": { + "navigationBarTitleText": "列表", + "enablePullDownRefresh": true + } + } + ], + "globalStyle": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "UniApp", + "navigationBarBackgroundColor": "#ffffff", + "backgroundColor": "#f5f5f5" + }, + "tabBar": { + "color": "#7A7E83", + "selectedColor": "#409EFF", + "borderStyle": "black", + "backgroundColor": "#ffffff", + "list": [ + { + "pagePath": "pages/index/index", + "text": "首页" + } + ] + } +} +``` + +## 注意事项 + +1. **easycom 配置**:必须在 pages.json 中配置 easycom +2. **路径正确性**:确保组件路径正确 +3. **样式配置**:合理配置页面样式,与 uView 主题协调 +4. **平台差异**:注意不同平台的配置差异 +5. **性能优化**:合理配置下拉刷新和上拉加载 diff --git a/.agents/bak-skills/uniapp-uview/examples/integration/uni-api.md b/.agents/bak-skills/uniapp-uview/examples/integration/uni-api.md new file mode 100644 index 0000000..baf6ca5 --- /dev/null +++ b/.agents/bak-skills/uniapp-uview/examples/integration/uni-api.md @@ -0,0 +1,384 @@ +# UniApp API Integration + +## UniApp API 与 uView 整合 + +在 UniApp 项目中使用 UniApp API 与 uView UI 组件配合使用。 + +### 网络请求 + +#### 使用 uni.request + +```javascript +// 基础请求 +uni.request({ + url: 'https://api.example.com/user/info', + method: 'GET', + data: { + id: 1 + }, + success: (res) => { + console.log(res.data) + this.$u.toast('请求成功') + }, + fail: (err) => { + console.error(err) + this.$u.toast({ + type: 'error', + message: '请求失败' + }) + } +}) +``` + +#### 配合 uView Loading + +```vue + + + +``` + +### 存储 API + +#### 使用 uni.setStorage + +```javascript +// 保存数据 +uni.setStorage({ + key: 'token', + data: 'xxx', + success: () => { + this.$u.toast('保存成功') + } +}) + +// 获取数据 +uni.getStorage({ + key: 'token', + success: (res) => { + console.log(res.data) + } +}) + +// 移除数据 +uni.removeStorage({ + key: 'token', + success: () => { + this.$u.toast('删除成功') + } +}) +``` + +#### 配合 uView 表单 + +```vue + + + +``` + +### 图片选择 + +#### 使用 uni.chooseImage + +```vue + + + +``` + +### 位置信息 + +#### 使用 uni.getLocation + +```vue + + + +``` + +### 分享功能 + +#### 使用 uni.share + +```vue + + + +``` + +### 页面生命周期 + +#### 配合 uView 组件 + +```vue + + + +``` + +### 条件编译 + +#### 平台特定 API + +```vue + + + +``` + +## 注意事项 + +1. **API 兼容性**:注意不同平台 API 的兼容性 +2. **权限配置**:某些 API 需要在 manifest.json 中配置权限 +3. **错误处理**:始终处理 API 调用的错误情况 +4. **条件编译**:使用条件编译处理平台差异 +5. **用户体验**:配合 uView 组件提供良好的用户反馈 diff --git a/.agents/bak-skills/uniapp-uview/examples/platform-specific/app.md b/.agents/bak-skills/uniapp-uview/examples/platform-specific/app.md new file mode 100644 index 0000000..8d41b57 --- /dev/null +++ b/.agents/bak-skills/uniapp-uview/examples/platform-specific/app.md @@ -0,0 +1,118 @@ +# App Platform + +## App 平台注意事项 + +在 App 平台(iOS/Android)使用 uView UI 时的特殊注意事项。 + +### manifest.json 配置 + +```json +{ + "app-plus": { + "usingComponents": true, + "nvueStyleCompiler": "uni-app", + "splashscreen": { + "alwaysShowBeforeRender": true, + "waiting": true, + "autoclose": true, + "delay": 0 + }, + "distribute": { + "android": { + "permissions": [ + "" + ] + }, + "ios": {} + } + } +} +``` + +### 权限配置 + +#### Android 权限 + +```json +{ + "app-plus": { + "distribute": { + "android": { + "permissions": [ + "", + "", + "" + ] + } + } + } +} +``` + +#### iOS 权限 + +在 manifest.json 中配置,或在 Xcode 中配置 Info.plist。 + +### 原生插件 + +App 平台可以使用原生插件: + +```javascript +// #ifdef APP-PLUS +// 使用 5+ API +plus.device.getInfo((info) => { + console.log('设备信息', info) +}) + +// 使用原生插件 +const plugin = uni.requireNativePlugin('your-plugin-name') +// #endif +``` + +### 条件编译 + +```vue + + + +``` + +### 状态栏适配 + +```vue + +``` + +### 注意事项 + +1. **权限配置**:根据功能需求配置相应权限 +2. **原生插件**:可以使用原生插件扩展功能 +3. **性能优化**:App 平台需要注意性能优化 +4. **打包配置**:正确配置打包参数 +5. **版本号**:正确配置版本号和版本名称 diff --git a/.agents/bak-skills/uniapp-uview/examples/platform-specific/h5.md b/.agents/bak-skills/uniapp-uview/examples/platform-specific/h5.md new file mode 100644 index 0000000..90dde90 --- /dev/null +++ b/.agents/bak-skills/uniapp-uview/examples/platform-specific/h5.md @@ -0,0 +1,159 @@ +# H5 Platform + +## H5 平台注意事项 + +在 H5 平台使用 uView UI 时的特殊注意事项。 + +### manifest.json 配置 + +```json +{ + "h5": { + "router": { + "mode": "hash", + "base": "/" + }, + "devServer": { + "https": false, + "port": 8080 + }, + "publicPath": "/", + "template": "index.html" + } +} +``` + +### 路由模式 + +H5 支持两种路由模式: + +#### Hash 模式(推荐) + +```json +{ + "h5": { + "router": { + "mode": "hash" + } + } +} +``` + +#### History 模式 + +```json +{ + "h5": { + "router": { + "mode": "history" + } + } +} +``` + +### 样式适配 + +H5 平台需要注意样式适配: + +```vue + + + +``` + +### 条件编译 + +使用条件编译处理 H5 平台特定逻辑: + +```vue + + + +``` + +### 浏览器兼容性 + +H5 平台需要考虑浏览器兼容性: + +```vue + + + +``` + +### 响应式布局 + +H5 平台可以使用媒体查询: + +```vue + +``` + +### 注意事项 + +1. **路由模式**:推荐使用 hash 模式,兼容性更好 +2. **样式单位**:H5 平台 rpx 会自动转换为 rem +3. **浏览器兼容**:注意不同浏览器的兼容性 +4. **性能优化**:H5 平台可以使用更多 Web API +5. **调试工具**:可以使用浏览器开发者工具调试 diff --git a/.agents/bak-skills/uniapp-uview/examples/platform-specific/miniprogram.md b/.agents/bak-skills/uniapp-uview/examples/platform-specific/miniprogram.md new file mode 100644 index 0000000..cb30081 --- /dev/null +++ b/.agents/bak-skills/uniapp-uview/examples/platform-specific/miniprogram.md @@ -0,0 +1,178 @@ +# Mini-Program Platform + +## 小程序平台注意事项 + +在微信小程序等小程序平台使用 uView UI 时的特殊注意事项。 + +### manifest.json 配置 + +```json +{ + "mp-weixin": { + "appid": "your-appid", + "setting": { + "urlCheck": false, + "es6": true, + "enhance": true, + "postcss": true, + "minified": true + }, + "usingComponents": true + } +} +``` + +### 组件使用 + +小程序平台需要确保组件正确注册: + +```json +{ + "easycom": { + "autoscan": true, + "custom": { + "^u-(.*)": "uview-ui/components/u-$1/u-$1.vue" + } + } +} +``` + +### 条件编译 + +使用条件编译处理小程序平台特定逻辑: + +```vue + + + +``` + +### 小程序 API + +#### 登录 + +```javascript +// #ifdef MP-WEIXIN +wx.login({ + success: (res) => { + if (res.code) { + // 发送 res.code 到后台换取 openId, sessionKey, unionId + this.$u.post('/api/login', { + code: res.code + }).then(result => { + this.$u.toast('登录成功') + }) + } + } +}) +// #endif +``` + +#### 获取用户信息 + +```javascript +// #ifdef MP-WEIXIN +wx.getUserProfile({ + desc: '用于完善用户资料', + success: (res) => { + this.userInfo = res.userInfo + this.$u.toast('获取用户信息成功') + } +}) +// #endif +``` + +#### 分享 + +```javascript +onShareAppMessage() { + // #ifdef MP-WEIXIN + return { + title: '分享标题', + path: '/pages/index/index', + imageUrl: '/static/share.png' + } + // #endif +} +``` + +### 页面配置 + +小程序页面需要在 pages.json 中配置: + +```json +{ + "pages": [ + { + "path": "pages/index/index", + "style": { + "navigationBarTitleText": "首页", + "enablePullDownRefresh": true + } + } + ] +} +``` + +### 下拉刷新 + +```vue + + + +``` + +### 注意事项 + +1. **AppID 配置**:必须在 manifest.json 中配置正确的 AppID +2. **URL 检查**:开发时可以关闭 urlCheck +3. **组件注册**:确保 easycom 配置正确 +4. **页面路径**:页面路径必须以 `/` 开头 +5. **代码包大小**:注意小程序代码包大小限制 diff --git a/.agents/bak-skills/uniapp-uview/examples/platform-specific/nvue.md b/.agents/bak-skills/uniapp-uview/examples/platform-specific/nvue.md new file mode 100644 index 0000000..40a432b --- /dev/null +++ b/.agents/bak-skills/uniapp-uview/examples/platform-specific/nvue.md @@ -0,0 +1,93 @@ +# nvue Platform + +## nvue 平台注意事项 + +在 nvue 页面使用 uView UI 时的特殊注意事项。 + +### manifest.json 配置 + +```json +{ + "app-plus": { + "nvueStyleCompiler": "uni-app", + "nvue": { + "flex-direction": "column" + } + } +} +``` + +### 样式限制 + +nvue 平台样式有限制: + +```vue + + + +``` + +### 组件兼容性 + +某些 uView 组件在 nvue 中可能不完全支持,需要使用条件编译: + +```vue + +``` + +### Flex 布局 + +nvue 主要使用 Flex 布局: + +```vue + + + +``` + +### 注意事项 + +1. **样式限制**:nvue 不支持所有 CSS 属性 +2. **组件兼容**:某些组件在 nvue 中可能不完全支持 +3. **Flex 布局**:主要使用 Flex 布局 +4. **性能**:nvue 性能更好,但功能有限 +5. **条件编译**:使用条件编译处理兼容性问题 diff --git a/.agents/bak-skills/uniapp-uview/templates/basic-uniapp-project.md b/.agents/bak-skills/uniapp-uview/templates/basic-uniapp-project.md new file mode 100644 index 0000000..f705ae2 --- /dev/null +++ b/.agents/bak-skills/uniapp-uview/templates/basic-uniapp-project.md @@ -0,0 +1,184 @@ +# Basic UniApp Project Template + +## 基础 UniApp 项目模板 + +这是一个基础的 UniApp + uView UI 项目模板。 + +### 项目结构 + +``` +uniapp-uview-project/ +├── uni_modules/ +│ └── uview-ui/ # uView UI 插件 +├── pages/ +│ ├── index/ +│ │ └── index.vue +│ └── ... +├── static/ # 静态资源 +├── App.vue # 应用入口 +├── main.js # 主入口文件 +├── pages.json # 页面配置 +├── manifest.json # 应用配置 +└── uni.scss # 全局样式变量 +``` + +### App.vue + +```vue + + + + + +``` + +### main.js + +```javascript +import App from './App' +import uView from 'uview-ui' + +// #ifdef VUE3 +import { createSSRApp } from 'vue' +export function createApp() { + const app = createSSRApp(App) + app.use(uView) + return { + app + } +} +// #endif + +// #ifndef VUE3 +import Vue from 'vue' +Vue.use(uView) +Vue.config.productionTip = false +App.mpType = 'app' +const app = new Vue({ + ...App +}) +app.$mount() +// #endif +``` + +### pages.json + +```json +{ + "easycom": { + "autoscan": true, + "custom": { + "^u-(.*)": "uview-ui/components/u-$1/u-$1.vue" + } + }, + "pages": [ + { + "path": "pages/index/index", + "style": { + "navigationBarTitleText": "首页" + } + } + ], + "globalStyle": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "UniApp", + "navigationBarBackgroundColor": "#ffffff", + "backgroundColor": "#f5f5f5" + } +} +``` + +### uni.scss + +```scss +/* 引入 uView 主题变量 */ +@import "uview-ui/theme.scss"; +``` + +### manifest.json + +```json +{ + "name": "uniapp-uview-project", + "appid": "", + "versionName": "1.0.0", + "versionCode": "100", + "transformPx": false, + "app-plus": { + "usingComponents": true + }, + "h5": { + "router": { + "mode": "hash" + } + }, + "mp-weixin": { + "appid": "", + "setting": { + "urlCheck": false + }, + "usingComponents": true + } +} +``` + +### pages/index/index.vue + +```vue + + + + + +``` diff --git a/.agents/bak-skills/uniapp-uview/templates/manifest-template.md b/.agents/bak-skills/uniapp-uview/templates/manifest-template.md new file mode 100644 index 0000000..a3b30f4 --- /dev/null +++ b/.agents/bak-skills/uniapp-uview/templates/manifest-template.md @@ -0,0 +1,86 @@ +# Manifest Configuration Template + +## manifest.json 配置模板 + +UniApp + uView 项目的 manifest.json 配置模板。 + +### 完整模板 + +```json +{ + "name": "uniapp-uview-project", + "appid": "", + "description": "UniApp + uView UI 项目", + "versionName": "1.0.0", + "versionCode": "100", + "transformPx": false, + "app-plus": { + "usingComponents": true, + "nvueStyleCompiler": "uni-app", + "splashscreen": { + "alwaysShowBeforeRender": true, + "waiting": true, + "autoclose": true, + "delay": 0 + }, + "distribute": { + "android": { + "permissions": [ + "" + ] + }, + "ios": {} + } + }, + "h5": { + "router": { + "mode": "hash", + "base": "/" + }, + "devServer": { + "https": false, + "port": 8080 + }, + "publicPath": "/", + "template": "index.html" + }, + "mp-weixin": { + "appid": "", + "setting": { + "urlCheck": false, + "es6": true, + "enhance": true, + "postcss": true, + "minified": true + }, + "usingComponents": true, + "permission": { + "scope.userLocation": { + "desc": "你的位置信息将用于小程序位置接口的效果展示" + } + } + }, + "mp-alipay": { + "usingComponents": true + }, + "mp-baidu": { + "usingComponents": true + }, + "mp-toutiao": { + "usingComponents": true + }, + "mp-qq": { + "usingComponents": true + }, + "quickapp": {}, + "vueVersion": "3" +} +``` + +### 使用说明 + +1. **appid**:小程序平台需要配置对应的 AppID +2. **usingComponents**:所有平台都需要设置为 true +3. **transformPx**:建议设置为 false,使用 rpx +4. **vueVersion**:指定 Vue 版本(2 或 3) +5. **平台配置**:根据目标平台配置相应参数 diff --git a/.agents/bak-skills/uniapp-uview/templates/pages-template.md b/.agents/bak-skills/uniapp-uview/templates/pages-template.md new file mode 100644 index 0000000..85445fc --- /dev/null +++ b/.agents/bak-skills/uniapp-uview/templates/pages-template.md @@ -0,0 +1,85 @@ +# Pages Configuration Template + +## pages.json 配置模板 + +UniApp + uView 项目的 pages.json 配置模板。 + +### 完整模板 + +```json +{ + "easycom": { + "autoscan": true, + "custom": { + "^u-(.*)": "uview-ui/components/u-$1/u-$1.vue" + } + }, + "pages": [ + { + "path": "pages/index/index", + "style": { + "navigationBarTitleText": "首页", + "navigationBarBackgroundColor": "#409EFF", + "navigationBarTextStyle": "white" + } + }, + { + "path": "pages/list/list", + "style": { + "navigationBarTitleText": "列表", + "enablePullDownRefresh": true + } + }, + { + "path": "pages/detail/detail", + "style": { + "navigationBarTitleText": "详情", + "navigationStyle": "custom" + } + } + ], + "globalStyle": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "UniApp", + "navigationBarBackgroundColor": "#ffffff", + "backgroundColor": "#f5f5f5" + }, + "tabBar": { + "color": "#7A7E83", + "selectedColor": "#409EFF", + "borderStyle": "black", + "backgroundColor": "#ffffff", + "list": [ + { + "pagePath": "pages/index/index", + "text": "首页", + "iconPath": "static/tab-home.png", + "selectedIconPath": "static/tab-home-current.png" + }, + { + "pagePath": "pages/user/user", + "text": "我的", + "iconPath": "static/tab-user.png", + "selectedIconPath": "static/tab-user-current.png" + } + ] + }, + "condition": { + "current": 0, + "list": [ + { + "name": "首页", + "path": "pages/index/index" + } + ] + } +} +``` + +### 使用说明 + +1. **easycom 配置**:必须配置,用于自动引入 uView 组件 +2. **pages 配置**:配置所有页面路径和样式 +3. **globalStyle**:配置全局样式 +4. **tabBar**:配置底部导航栏(可选) +5. **condition**:配置条件编译(开发工具用) diff --git a/.agents/bak-skills/uniappx-project-creator/SKILL.md b/.agents/bak-skills/uniappx-project-creator/SKILL.md new file mode 100644 index 0000000..716f50b --- /dev/null +++ b/.agents/bak-skills/uniappx-project-creator/SKILL.md @@ -0,0 +1,124 @@ +--- +name: uniappx-project-creator +description: Provides one-command project creation for uni-app-x including Vue 3 + TypeScript + Vite setup, configuration, and template generation. Use when the user asks to create a uni-app-x project with a single command, needs to initialize a new uni-app-x project, or generate uni-app-x project structure. +license: Complete terms in LICENSE.txt +--- + +## When to use this skill + +Use this skill whenever the user wants to: +- Create a new uni-app-x project from scratch +- Initialize uni-app-x project structure with TypeScript and Vue 3 +- Set up development environment for uni-app-x +- Generate project templates with TypeScript configuration +- Configure manifest.json and pages.json for uni-app-x +- Create uni-app-x pages and components with TypeScript +- Set up uni-app-x project with HBuilderX or CLI + +## How to use this skill + +To create a uni-app-x project with a single command or via HBuilderX: + +1. **Identify the project type** from the user's request: + - Standard uni-app-x project → Use TypeScript + Vue 3 template + - HBuilderX project → Use HBuilderX creation method + - CLI project → Use official CLI commands + +2. **Load the appropriate example file** from the `examples/guide/` directory: + - `examples/guide/installation.md` - Installation and environment setup + - `examples/guide/quick-start.md` - Quick start guide + - `examples/guide/project-types.md` - Different project types and templates + +3. **Load the appropriate template file** from the `templates/` directory: + - `templates/project-templates.md` - Project structure templates + - `templates/cli-commands.md` - CLI command templates + +4. **Follow the specific instructions** in those files for project creation, structure, and configuration + +5. **Generate the project structure** with proper TypeScript and Vue 3 configurations + +**Important Notes**: +- This skill focuses on uni-app-x CLI quickstart and HBuilderX creation flows +- Use one command creation when the user wants "一句话创建" +- uni-app-x requires Vue 3 + TypeScript + Vite + +## Examples and Templates + +### Examples + +Located in `examples/guide/`: + +- **installation.md** - Installation guide for uni-app-x development environment +- **quick-start.md** - Quick start guide for creating first uni-app-x project +- **project-types.md** - Different project types and configurations + +### Templates + +Located in `templates/`: + +- **project-templates.md** - Complete project structure templates with TypeScript +- **cli-commands.md** - CLI command templates for project creation + +## API Reference + +This skill focuses on project creation and initialization. For component and API references, see `uniappx-project-guide`. + +## Best Practices + +1. **Use TypeScript**: uni-app-x requires TypeScript, ensure proper type definitions +2. **Vue 3 Composition API**: Use Composition API with ` + + +``` + +3. **在 `pages.json` 中注册页面**: + +```json +{ + "pages": [ + { + "path": "pages/index/index", + "style": { + "navigationBarTitleText": "首页" + } + }, + { + "path": "pages/hello/hello", + "style": { + "navigationBarTitleText": "Hello" + } + } + ] +} +``` + +## 创建第一个组件(TypeScript) + +1. **在 `src/components` 目录下创建组件**: + +``` +src/components/ +└── my-button/ + └── my-button.vue +``` + +2. **组件代码**: + +```vue + + + + + +``` + +3. **在页面中使用**: + +```vue + + + +``` + +## 与 uni-app 的区别 + +### 1. 技术栈 + +- **uni-app**:Vue 2/3 + JavaScript +- **uni-app-x**:Vue 3 + TypeScript + Vite + +### 2. 开发体验 + +- 更好的 TypeScript 支持 +- 更快的构建速度(Vite) +- 更好的代码提示 + +### 3. 性能 + +- 更小的包体积 +- 更快的启动速度 +- 更好的运行时性能 + +## 下一步 + +- 学习 uni-app-x 组件:参考 `uniappx-project` +- 学习 uni-app-x API:参考 `uniappx-project` +- 配置项目:参考 `templates/project-templates.md` diff --git a/.agents/bak-skills/uniappx-project-creator/templates/cli-commands.md b/.agents/bak-skills/uniappx-project-creator/templates/cli-commands.md new file mode 100644 index 0000000..eed8db2 --- /dev/null +++ b/.agents/bak-skills/uniappx-project-creator/templates/cli-commands.md @@ -0,0 +1,129 @@ +# uni-app-x CLI 命令模板 + +## 官方文档 + +参考官方文档:https://uniapp.dcloud.net.cn/quickstart-cli.html + +## 项目创建命令 + +### 使用官方模板 + +```bash +# 创建项目 +npx degit dcloudio/uni-preset-vue-x my-project + +# 或使用官方脚手架 +npm create uni-app-x@latest my-project +``` + +### 使用 HBuilderX + +1. 文件 → 新建 → 项目 +2. 选择 **uni-app x** +3. 选择模板 +4. 填写项目信息 +5. 点击创建 + +## 项目运行命令 + +### 开发环境 + +```bash +# H5 平台 +npm run dev:h5 + +# 微信小程序 +npm run dev:mp-weixin + +# App(需要 HBuilderX) +npm run dev:app +``` + +### 生产环境 + +```bash +# H5 平台 +npm run build:h5 + +# 微信小程序 +npm run build:mp-weixin + +# App(需要 HBuilderX) +npm run build:app +``` + +## 常用命令 + +### 安装依赖 + +```bash +npm install +``` + +### 类型检查 + +```bash +# TypeScript 类型检查 +npm run type-check + +# 或使用 tsc +npx tsc --noEmit +``` + +### 代码检查 + +```bash +# ESLint 检查 +npm run lint + +# 自动修复 +npm run lint:fix +``` + +## 一键创建项目脚本 + +```bash +#!/bin/bash +# create-uniappx-project.sh + +PROJECT_NAME=$1 + +if [ -z "$PROJECT_NAME" ]; then + echo "Usage: ./create-uniappx-project.sh " + exit 1 +fi + +echo "Creating uni-app-x project: $PROJECT_NAME" +npx degit dcloudio/uni-preset-vue-x $PROJECT_NAME +cd $PROJECT_NAME +npm install +echo "Project created successfully!" +echo "Run 'npm run dev:h5' to start development server" +``` + +## 项目初始化完整流程 + +```bash +# 1. 创建项目 +npx degit dcloudio/uni-preset-vue-x my-project + +# 2. 进入项目目录 +cd my-project + +# 3. 安装依赖 +npm install + +# 4. 初始化 Git(可选) +git init +git add . +git commit -m "Initial commit" + +# 5. 运行项目 +npm run dev:h5 +``` + +## 参考资源 + +- uni-app-x 文档:https://doc.dcloud.net.cn/uni-app-x/ +- TypeScript 文档:https://www.typescriptlang.org/ +- Vite 文档:https://cn.vitejs.dev/ diff --git a/.agents/bak-skills/uniappx-project-creator/templates/project-templates.md b/.agents/bak-skills/uniappx-project-creator/templates/project-templates.md new file mode 100644 index 0000000..cf8ccf0 --- /dev/null +++ b/.agents/bak-skills/uniappx-project-creator/templates/project-templates.md @@ -0,0 +1,245 @@ +# uni-app-x 项目模板 + +## 官方文档 + +参考官方文档:https://uniapp.dcloud.net.cn/quickstart-cli.html + +## 标准项目结构 + +``` +my-uniappx-project/ +├── src/ +│ ├── pages/ # 页面目录 +│ │ ├── index/ +│ │ │ └── index.vue +│ │ └── ... +│ ├── components/ # 组件目录 +│ │ └── ... +│ ├── static/ # 静态资源 +│ ├── utils/ # 工具函数 +│ ├── api/ # API 接口 +│ ├── store/ # 状态管理(Pinia) +│ ├── App.vue # 应用入口 +│ └── main.ts # TypeScript 入口 +├── manifest.json # 应用配置 +├── pages.json # 页面路由配置 +├── vite.config.ts # Vite 配置 +├── tsconfig.json # TypeScript 配置 +└── package.json +``` + +## manifest.json 模板 + +```json +{ + "name": "my-uniappx", + "appid": "", + "description": "uni-app-x 项目", + "versionName": "1.0.0", + "versionCode": "100", + "transformPx": false, + "uni-app-x": { + "compilerVersion": "1.0.0", + "vueVersion": "3", + "typescript": true + }, + "app-plus": { + "usingComponents": true, + "compilerVersion": 3 + }, + "h5": { + "router": { + "mode": "hash", + "base": "/" + } + }, + "mp-weixin": { + "appid": "", + "setting": { + "urlCheck": false + }, + "usingComponents": true + } +} +``` + +## pages.json 模板 + +```json +{ + "pages": [ + { + "path": "pages/index/index", + "style": { + "navigationBarTitleText": "首页" + } + } + ], + "globalStyle": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "uni-app-x", + "navigationBarBackgroundColor": "#F8F8F8", + "backgroundColor": "#F8F8F8" + } +} +``` + +## 页面模板(TypeScript + Composition API) + +```vue + + + + + +``` + +## 组件模板(TypeScript) + +```vue + + + + + +``` + +## App.vue 模板 + +```vue + + + + + +``` + +## main.ts 模板 + +```typescript +import { createSSRApp } from 'vue' +import App from './App.vue' + +export function createApp() { + const app = createSSRApp(App) + return { + app + } +} +``` + +## vite.config.ts 模板 + +```typescript +import { defineConfig } from 'vite' +import uni from '@dcloudio/vite-plugin-uni' + +export default defineConfig({ + plugins: [uni()], + server: { + port: 3000, + open: true + } +}) +``` + +## tsconfig.json 模板 + +```json +{ + "compilerOptions": { + "target": "ES2020", + "module": "ESNext", + "lib": ["ES2020", "DOM"], + "jsx": "preserve", + "moduleResolution": "node", + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "resolveJsonModule": true, + "isolatedModules": true, + "types": ["@dcloudio/types"] + }, + "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"], + "exclude": ["node_modules"] +} +``` diff --git a/.agents/bak-skills/uniappx-project/LICENSE.txt b/.agents/bak-skills/uniappx-project/LICENSE.txt new file mode 100644 index 0000000..b03965a --- /dev/null +++ b/.agents/bak-skills/uniappx-project/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 partme-ai + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/.agents/bak-skills/uniappx-project/SKILL.md b/.agents/bak-skills/uniappx-project/SKILL.md new file mode 100644 index 0000000..f78e3ad --- /dev/null +++ b/.agents/bak-skills/uniappx-project/SKILL.md @@ -0,0 +1,101 @@ +--- +name: uniappx-project +description: Provides comprehensive uni-app-x component and API integration guidance. Use when the user needs official uni-app-x components or APIs, wants per-component or per-API examples, or needs cross-platform compatibility details for uni-app-x. +license: Complete terms in LICENSE.txt +--- + +## When to use this skill + +Use this skill whenever the user wants to: +- Use any uni-app-x built-in component +- Use any uni-app-x API (network, storage, device, UI, navigation, media, etc.) +- Access per-component or per-API examples with official doc links +- Check platform compatibility for components and APIs in uni-app-x +- Build uni-app-x applications with Vue 3 + TypeScript + Vite + +## How to use this skill + +This skill is organized to match the official uni-app-x components and API documentation: + +1. **Choose component or API category**: + - Components → `examples/components/built-in/` + - APIs → `examples/api/` (categorized by domain) + +2. **Open the matching example file**: + - Each component or API has its own example file + - Each example includes the official documentation URL + - Examples mirror the official documentation examples + +3. **Use references when you need full specs**: + - `references/components/built-in/` for built-in components + - `references/api/` for API parameter/return/compatibility details + +## Examples and References + +### Components (Built-in) +- Examples: `examples/components/built-in/*.md` +- References: `references/components/built-in/*.md` +- Official docs: https://doc.dcloud.net.cn/uni-app-x/component/ + +### APIs +- Examples: `examples/api/{category}/*.md` +- References: `references/api/*.md` +- Official docs: https://doc.dcloud.net.cn/uni-app-x/api/ + +## Best Practices + +1. **One file per component/API**: Each component and API has an independent example file with official doc link. +2. **Follow platform compatibility**: Check the compatibility section in each example/reference. +3. **Use conditional compilation**: Use `#ifdef`/`#endif` for platform-specific logic. +4. **Keep examples aligned**: Use the official documentation examples as the source of truth. +5. **Prefer references for specs**: Use `references/` for full parameter tables and compatibility. + +## Resources + +- **Components**: https://doc.dcloud.net.cn/uni-app-x/component/ +- **APIs**: https://doc.dcloud.net.cn/uni-app-x/api/ +- **uni-app-x**: https://doc.dcloud.net.cn/uni-app-x/ + +## Keywords + +uniappx, uni-app-x, components, api, built-in components, examples, references, Vue 3, TypeScript, Vite, H5, App, mini program, 跨平台, 组件, API, 官方文档 + +## 能力边界 + +### ✅ 适用场景 +- 当你需要使用此技能对应的技术栈时 +- 当项目需要遵循最佳实践时 +- 当需要快速上手或深入理解核心概念时 + +### ⚠️ 需要注意 +- 复杂业务逻辑需要结合具体场景调整 +- 性能优化需要根据实际数据量评估 + +### ❌ 不适用场景 +- 不相关的技术栈或框架 +- 需要完全自定义的特殊场景 + +## 常见陷阱 (Gotchas) + +1. **版本兼容性**:注意框架版本与依赖库的兼容性,不同版本 API 可能有差异 +2. **配置文件格式**:配置文件格式错误是最常见的问题,建议使用编辑器的语法检查 +3. **环境变量**:确保所有必要的环境变量已正确设置,敏感信息不要硬编码 +4. **依赖冲突**:多版本共存时注意依赖冲突,使用 lock 文件锁定版本 +5. **性能陷阱**:大数据量场景下注意性能优化,避免 N+1 查询等常见问题 + +## 使用流程 + +### Step 1: 环境准备 +确保开发环境已安装必要的依赖和工具。 + +### Step 2: 配置初始化 +根据项目需求进行基础配置。 + +### Step 3: 核心功能使用 +按照示例代码实现核心功能。 + +### Step 4: 测试验证 +运行测试确保功能正常。 + +### Step 5: 部署上线 +完成开发后进行部署和监控。 diff --git a/.agents/bak-skills/uniappx-project/examples/api/device/get-battery-info.md b/.agents/bak-skills/uniappx-project/examples/api/device/get-battery-info.md new file mode 100644 index 0000000..fdff655 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/device/get-battery-info.md @@ -0,0 +1,178 @@ +# uni.getBatteryInfo - 获取电池信息示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/system/battery.html#getbatteryinfo + +## 概述 + +`uni.getBatteryInfo` 用于获取设备电池信息。 + +## 基础用法 + +```javascript +uni.getBatteryInfo({ + success: (res) => { + console.log('电池信息', res) + } +}) +``` + +## 完整示例 + +### 示例 1: 获取电池信息 + +```javascript +uni.getBatteryInfo({ + success: (res) => { + console.log('电池电量', res.level, '%') + console.log('是否正在充电', res.isCharging) + }, + fail: (err) => { + console.error('获取失败', err) + } +}) +``` + +### 示例 2: 在页面中使用 + +```vue + + + +``` + +### 示例 3: 低电量提醒 + +```javascript +function checkBatteryLevel() { + uni.getBatteryInfo({ + success: (res) => { + if (res.level < 20 && !res.isCharging) { + uni.showModal({ + title: '低电量提醒', + content: `当前电量仅剩${res.level}%,建议连接充电器`, + showCancel: false + }) + } + } + }) +} + +// 定时检查 +setInterval(checkBatteryLevel, 60000) // 每分钟检查一次 +``` + +### 示例 4: 同步版本 + +```javascript +try { + const batteryInfo = uni.getBatteryInfoSync() + console.log('电池电量', batteryInfo.level, '%') + console.log('是否正在充电', batteryInfo.isCharging) +} catch (err) { + console.error('获取失败', err) +} +``` + +### 示例 5: 根据电量调整策略 + +```javascript +function getBatteryInfo() { + return new Promise((resolve, reject) => { + uni.getBatteryInfo({ + success: (res) => { + resolve(res) + }, + fail: (err) => { + reject(err) + } + }) + }) +} + +// 根据电量决定是否执行耗电操作 +async function performHeavyTask() { + const batteryInfo = await getBatteryInfo() + + if (batteryInfo.level < 20 && !batteryInfo.isCharging) { + uni.showModal({ + title: '提示', + content: '电量较低,建议连接充电器后再执行', + success: (res) => { + if (res.confirm) { + // 执行任务 + console.log('执行任务') + } + } + }) + } else { + // 直接执行 + console.log('执行任务') + } +} +``` + +## 返回值 + +| 参数名 | 类型 | 说明 | +|--------|------|------| +| level | Number | 设备电量,范围 1 - 100 | +| isCharging | Boolean | 是否正在充电 | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ❌ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. H5 平台不支持此 API +2. `level` 范围是 1-100,表示电量百分比 +3. `isCharging` 表示设备是否正在充电 +4. 同步版本 `getBatteryInfoSync` 性能更好 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/system/battery.html#getbatteryinfo +- **同步版本**: https://doc.dcloud.net.cn/uni-app-x/api/system/battery.html#getbatteryinfosync diff --git a/.agents/bak-skills/uniappx-project/examples/api/device/get-network-type.md b/.agents/bak-skills/uniappx-project/examples/api/device/get-network-type.md new file mode 100644 index 0000000..6d0e9ce --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/device/get-network-type.md @@ -0,0 +1,195 @@ +# uni.getNetworkType - 获取网络类型示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/system/network.html#getnetworktype + +## 概述 + +`uni.getNetworkType` 用于获取设备当前网络类型。 + +## 基础用法 + +```javascript +uni.getNetworkType({ + success: (res) => { + console.log('网络类型', res.networkType) + } +}) +``` + +## 完整示例 + +### 示例 1: 获取网络类型 + +```javascript +uni.getNetworkType({ + success: (res) => { + console.log('网络类型', res.networkType) + // 可能的值:wifi、2g、3g、4g、5g、unknown、none + }, + fail: (err) => { + console.error('获取失败', err) + } +}) +``` + +### 示例 2: 检查网络状态 + +```javascript +function checkNetwork() { + uni.getNetworkType({ + success: (res) => { + if (res.networkType === 'none') { + uni.showToast({ + title: '网络不可用', + icon: 'none' + }) + } else if (res.networkType === '2g' || res.networkType === '3g') { + uni.showModal({ + title: '提示', + content: '当前网络较慢,建议使用WiFi', + showCancel: false + }) + } else { + console.log('网络正常', res.networkType) + } + } + }) +} +``` + +### 示例 3: 在页面中使用 + +```vue + + + +``` + +### 示例 4: 监听网络状态变化 + +```javascript +// 监听网络状态变化 +uni.onNetworkStatusChange((res) => { + console.log('网络类型', res.networkType) + console.log('是否联网', res.isConnected) + + if (!res.isConnected) { + uni.showToast({ + title: '网络已断开', + icon: 'none' + }) + } else { + uni.showToast({ + title: '网络已连接', + icon: 'success' + }) + } +}) + +// 获取当前网络状态 +uni.getNetworkType({ + success: (res) => { + console.log('当前网络类型', res.networkType) + } +}) +``` + +### 示例 5: 根据网络类型调整策略 + +```javascript +function getNetworkType() { + return new Promise((resolve, reject) => { + uni.getNetworkType({ + success: (res) => { + resolve(res.networkType) + }, + fail: (err) => { + reject(err) + } + }) + }) +} + +// 根据网络类型决定是否加载高清图片 +async function loadImage() { + const networkType = await getNetworkType() + + if (networkType === 'wifi' || networkType === '4g' || networkType === '5g') { + // 加载高清图片 + return 'https://example.com/hd-image.jpg' + } else { + // 加载压缩图片 + return 'https://example.com/compressed-image.jpg' + } +} +``` + +## 返回值 + +| 参数名 | 类型 | 说明 | +|--------|------|------| +| networkType | String | 网络类型,可能的值:wifi、2g、3g、4g、5g、unknown、none | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. `networkType` 可能的值:wifi、2g、3g、4g、5g、unknown、none +2. `none` 表示无网络连接 +3. 建议配合 `onNetworkStatusChange` 监听网络变化 +4. 可以根据网络类型调整加载策略 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/system/network.html#getnetworktype +- **监听网络变化**: https://doc.dcloud.net.cn/uni-app-x/api/system/network.html#onnetworkstatuschange diff --git a/.agents/bak-skills/uniappx-project/examples/api/device/get-screen-brightness.md b/.agents/bak-skills/uniappx-project/examples/api/device/get-screen-brightness.md new file mode 100644 index 0000000..2a92b0e --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/device/get-screen-brightness.md @@ -0,0 +1,192 @@ +# uni.getScreenBrightness - 获取屏幕亮度示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/device/screen.html#getscreenbrightness + +## 概述 + +`uni.getScreenBrightness` 用于获取屏幕亮度。 + +## 基础用法 + +```javascript +uni.getScreenBrightness({ + success: (res) => { + console.log('屏幕亮度', res.value) + } +}) +``` + +## 完整示例 + +### 示例 1: 获取屏幕亮度 + +```javascript +uni.getScreenBrightness({ + success: (res) => { + console.log('屏幕亮度', res.value) // 范围 0 - 1 + console.log('亮度百分比', (res.value * 100).toFixed(0) + '%') + }, + fail: (err) => { + console.error('获取失败', err) + } +}) +``` + +### 示例 2: 在页面中使用 + +```vue + + + +``` + +### 示例 3: 保存和恢复亮度 + +```vue + + + +``` + +### 示例 4: 检查亮度设置 + +```javascript +function checkBrightness() { + uni.getScreenBrightness({ + success: (res) => { + if (res.value < 0.3) { + console.log('屏幕较暗') + } else if (res.value > 0.8) { + console.log('屏幕较亮') + } else { + console.log('屏幕亮度适中') + } + } + }) +} +``` + +## 返回值 + +| 参数名 | 类型 | 说明 | +|--------|------|------| +| value | Number | 屏幕亮度值,范围 0 - 1 | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ❌ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. H5 平台不支持此 API +2. `value` 范围是 0-1,0 表示最暗,1 表示最亮 +3. 可以配合 `setScreenBrightness` 使用 +4. 建议在设置亮度前先获取当前亮度 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/device/screen.html#getscreenbrightness +- **设置亮度**: https://doc.dcloud.net.cn/uni-app-x/api/device/screen.html#setscreenbrightness diff --git a/.agents/bak-skills/uniappx-project/examples/api/device/get-system-info.md b/.agents/bak-skills/uniappx-project/examples/api/device/get-system-info.md new file mode 100644 index 0000000..2de68f8 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/device/get-system-info.md @@ -0,0 +1,209 @@ +# uni.getSystemInfo - 获取系统信息示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/system/info.html#getsysteminfo + +## 概述 + +`uni.getSystemInfo` 用于获取系统信息,包括设备信息、屏幕信息等。 + +## 基础用法 + +```javascript +uni.getSystemInfo({ + success: (res) => { + console.log('系统信息', res) + } +}) +``` + +## 完整示例 + +### 示例 1: 获取系统信息 + +```javascript +uni.getSystemInfo({ + success: (res) => { + console.log('手机品牌', res.brand) + console.log('手机型号', res.model) + console.log('系统版本', res.system) + console.log('平台', res.platform) + console.log('屏幕宽度', res.windowWidth) + console.log('屏幕高度', res.windowHeight) + } +}) +``` + +### 示例 2: 同步获取系统信息 + +```javascript +try { + const systemInfo = uni.getSystemInfoSync() + console.log('系统信息', systemInfo) +} catch (err) { + console.error('获取失败', err) +} +``` + +### 示例 3: 在页面中使用 + +```vue + + + + + +``` + +### 示例 4: 适配不同屏幕 + +```vue + + + +``` + +### 示例 5: 判断平台 + +```javascript +const systemInfo = uni.getSystemInfoSync() + +// 判断平台 +if (systemInfo.platform === 'ios') { + console.log('iOS 平台') +} else if (systemInfo.platform === 'android') { + console.log('Android 平台') +} + +// 判断是否为 App +if (systemInfo.platform !== 'devtools') { + console.log('非开发工具环境') +} +``` + +## 返回值说明 + +| 参数名 | 类型 | 说明 | +|--------|------|------| +| brand | String | 手机品牌 | +| model | String | 手机型号 | +| system | String | 操作系统版本 | +| platform | String | 客户端平台 | +| windowWidth | Number | 窗口宽度 | +| windowHeight | Number | 窗口高度 | +| pixelRatio | Number | 设备像素比 | +| screenWidth | Number | 屏幕宽度 | +| screenHeight | Number | 屏幕高度 | +| statusBarHeight | Number | 状态栏高度 | +| safeArea | Object | 安全区域 | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. 建议在 `onLoad` 中获取系统信息 +2. 同步版本 `getSystemInfoSync` 性能更好 +3. 不同平台返回的信息可能不同 +4. 使用 `windowWidth` 和 `windowHeight` 进行屏幕适配 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/system/info.html#getsysteminfo +- **同步版本**: https://doc.dcloud.net.cn/uni-app-x/api/system/info.html#getsysteminfosync diff --git a/.agents/bak-skills/uniappx-project/examples/api/device/set-screen-brightness.md b/.agents/bak-skills/uniappx-project/examples/api/device/set-screen-brightness.md new file mode 100644 index 0000000..8d16eeb --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/device/set-screen-brightness.md @@ -0,0 +1,195 @@ +# uni.setScreenBrightness - 设置屏幕亮度示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/device/screen.html#setscreenbrightness + +## 概述 + +`uni.setScreenBrightness` 用于设置屏幕亮度。 + +## 基础用法 + +```javascript +uni.setScreenBrightness({ + value: 0.5 +}) +``` + +## 完整示例 + +### 示例 1: 设置屏幕亮度 + +```javascript +uni.setScreenBrightness({ + value: 0.5, // 亮度值,范围 0 - 1 + success: () => { + console.log('设置成功') + }, + fail: (err) => { + console.error('设置失败', err) + } +}) +``` + +### 示例 2: 在页面中使用 + +```vue + + + +``` + +### 示例 3: 自动调节亮度 + +```javascript +function autoAdjustBrightness() { + // 获取当前时间 + const hour = new Date().getHours() + + // 晚上(18:00-6:00)降低亮度 + if (hour >= 18 || hour < 6) { + uni.setScreenBrightness({ + value: 0.3 // 较暗 + }) + } else { + uni.setScreenBrightness({ + value: 0.8 // 较亮 + }) + } +} +``` + +### 示例 4: 护眼模式 + +```vue + + + +``` + +### 示例 5: 根据环境光调节 + +```javascript +// 注意:此功能需要配合其他API实现 +function adjustBrightnessByAmbient() { + // 获取环境光强度(需要其他API支持) + // 这里只是示例逻辑 + const ambientLight = 0.5 // 假设获取到的环境光强度 + + // 根据环境光设置屏幕亮度 + const screenBrightness = Math.max(0.2, Math.min(1.0, ambientLight)) + + uni.setScreenBrightness({ + value: screenBrightness + }) +} +``` + +## 参数说明 + +| 参数名 | 类型 | 必填 | 说明 | +|--------|------|------|------| +| value | Number | 是 | 屏幕亮度值,范围 0 - 1,0 最暗,1 最亮 | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ❌ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. H5 平台不支持此 API +2. `value` 范围是 0-1,0 表示最暗,1 表示最亮 +3. 设置后立即生效 +4. 建议在用户退出应用时恢复系统默认亮度 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/device/screen.html#setscreenbrightness +- **获取亮度**: https://doc.dcloud.net.cn/uni-app-x/api/device/screen.html#getscreenbrightness diff --git a/.agents/bak-skills/uniappx-project/examples/api/file/get-file-info.md b/.agents/bak-skills/uniappx-project/examples/api/file/get-file-info.md new file mode 100644 index 0000000..731dbf0 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/file/get-file-info.md @@ -0,0 +1,232 @@ +# uni.getFileInfo - 获取文件信息示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/file/file.html#getfileinfo + +## 概述 + +`uni.getFileInfo` 用于获取文件信息。 + +## 基础用法 + +```javascript +uni.getFileInfo({ + filePath: 'file_path', + success: (res) => { + console.log('文件大小', res.size) + } +}) +``` + +## 完整示例 + +### 示例 1: 获取文件信息 + +```javascript +uni.getFileInfo({ + filePath: 'file_path', + success: (res) => { + console.log('文件大小', res.size, '字节') + console.log('文件大小(KB)', (res.size / 1024).toFixed(2), 'KB') + console.log('文件大小(MB)', (res.size / 1024 / 1024).toFixed(2), 'MB') + }, + fail: (err) => { + console.error('获取失败', err) + } +}) +``` + +### 示例 2: 检查文件大小 + +```javascript +function checkFileSize(filePath) { + return new Promise((resolve, reject) => { + uni.getFileInfo({ + filePath: filePath, + success: (res) => { + const sizeInMB = res.size / 1024 / 1024 + if (sizeInMB > 10) { + uni.showModal({ + title: '提示', + content: `文件大小 ${sizeInMB.toFixed(2)}MB,超过10MB,建议压缩后上传`, + showCancel: false + }) + } + resolve(res) + }, + fail: (err) => { + reject(err) + } + }) + }) +} + +// 使用 +checkFileSize('file_path').then(res => { + console.log('文件信息', res) +}) +``` + +### 示例 3: 在页面中使用 + +```vue + + + +``` + +### 示例 4: 上传前检查文件大小 + +```javascript +function uploadFileWithSizeCheck(filePath) { + uni.getFileInfo({ + filePath: filePath, + success: (res) => { + const maxSize = 10 * 1024 * 1024 // 10MB + + if (res.size > maxSize) { + uni.showModal({ + title: '提示', + content: `文件大小 ${(res.size / 1024 / 1024).toFixed(2)}MB,超过限制`, + showCancel: false + }) + return + } + + // 上传文件 + uni.uploadFile({ + url: 'https://api.example.com/upload', + filePath: filePath, + name: 'file', + success: (uploadRes) => { + console.log('上传成功', uploadRes) + } + }) + } + }) +} +``` + +### 示例 5: 获取多个文件信息 + +```javascript +function getMultipleFileInfo(filePaths) { + const fileInfoList = [] + let completedCount = 0 + + filePaths.forEach((filePath, index) => { + uni.getFileInfo({ + filePath: filePath, + success: (res) => { + fileInfoList[index] = { + path: filePath, + size: res.size + } + completedCount++ + + if (completedCount === filePaths.length) { + console.log('所有文件信息', fileInfoList) + const totalSize = fileInfoList.reduce((sum, info) => sum + info.size, 0) + console.log('总大小', (totalSize / 1024 / 1024).toFixed(2), 'MB') + } + } + }) + }) +} + +// 使用 +uni.chooseFile({ + count: 5, + success: (res) => { + const filePaths = res.tempFiles.map(file => file.path) + getMultipleFileInfo(filePaths) + } +}) +``` + +## 参数说明 + +| 参数名 | 类型 | 必填 | 说明 | +|--------|------|------|------| +| filePath | String | 是 | 文件路径 | + +## 返回值 + +| 参数名 | 类型 | 说明 | +|--------|------|------| +| size | Number | 文件大小,单位:字节 | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ❌ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. H5 平台不支持此 API +2. `size` 单位是字节(bytes) +3. 可以通过 `size` 判断文件大小,进行上传限制 +4. 建议在上传前检查文件大小 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/file/file.html#getfileinfo diff --git a/.agents/bak-skills/uniappx-project/examples/api/file/get-saved-file-list.md b/.agents/bak-skills/uniappx-project/examples/api/file/get-saved-file-list.md new file mode 100644 index 0000000..9296077 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/file/get-saved-file-list.md @@ -0,0 +1,347 @@ +# uni.getSavedFileList - 获取已保存的文件列表示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/file/file.html#getsavedfilelist + +## 概述 + +`uni.getSavedFileList` 用于获取本地已保存的文件列表。 + +## 基础用法 + +```javascript +uni.getSavedFileList({ + success: (res) => { + console.log('文件列表', res.fileList) + } +}) +``` + +## 完整示例 + +### 示例 1: 获取文件列表 + +```javascript +uni.getSavedFileList({ + success: (res) => { + console.log('文件数量', res.fileList.length) + res.fileList.forEach((file, index) => { + console.log(`文件${index + 1}:`, file.filePath) + console.log(`大小:`, file.size, '字节') + console.log(`创建时间:`, new Date(file.createTime)) + }) + }, + fail: (err) => { + console.error('获取失败', err) + } +}) +``` + +### 示例 2: 在页面中使用 + +```vue + + + + + +``` + +### 示例 3: 计算总文件大小 + +```javascript +function getTotalFileSize() { + return new Promise((resolve, reject) => { + uni.getSavedFileList({ + success: (res) => { + const totalSize = res.fileList.reduce((sum, file) => sum + file.size, 0) + const totalSizeMB = (totalSize / 1024 / 1024).toFixed(2) + console.log('总文件大小', totalSizeMB, 'MB') + resolve({ + fileList: res.fileList, + totalSize: totalSize, + totalSizeMB: totalSizeMB + }) + }, + fail: (err) => { + reject(err) + } + }) + }) +} + +// 使用 +getTotalFileSize().then(result => { + console.log('文件统计', result) +}) +``` + +### 示例 4: 清理旧文件 + +```javascript +function cleanOldFiles(maxAge = 7 * 24 * 60 * 60 * 1000) { + // maxAge: 最大保留时间(毫秒),默认7天 + uni.getSavedFileList({ + success: (res) => { + const now = Date.now() + let deletedCount = 0 + + res.fileList.forEach(file => { + if (now - file.createTime > maxAge) { + uni.removeSavedFile({ + filePath: file.filePath, + success: () => { + deletedCount++ + console.log('已删除旧文件', file.filePath) + } + }) + } + }) + + setTimeout(() => { + uni.showToast({ + title: `已清理${deletedCount}个文件`, + icon: 'success' + }) + }, 1000) + } + }) +} + +// 使用:清理7天前的文件 +cleanOldFiles() +``` + +### 示例 5: 文件管理 + +```vue + + + +``` + +## 返回值 + +| 参数名 | 类型 | 说明 | +|--------|------|------| +| fileList | Array | 文件列表,每个文件包含 filePath、size、createTime | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ❌ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. H5 平台不支持此 API +2. 返回的文件列表包含通过 `uni.saveFile` 保存的文件 +3. 可以通过 `createTime` 判断文件创建时间 +4. 建议定期清理不需要的文件 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/file/file.html#getsavedfilelist +- **保存文件**: https://doc.dcloud.net.cn/uni-app-x/api/file/file.html#savefile +- **删除文件**: https://doc.dcloud.net.cn/uni-app-x/api/file/file.html#removesavedfile diff --git a/.agents/bak-skills/uniappx-project/examples/api/file/save-file.md b/.agents/bak-skills/uniappx-project/examples/api/file/save-file.md new file mode 100644 index 0000000..075b584 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/file/save-file.md @@ -0,0 +1,223 @@ +# uni.saveFile - 保存文件示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/file/file.html#savefile + +## 概述 + +`uni.saveFile` 用于保存文件到本地。 + +## 基础用法 + +```javascript +uni.saveFile({ + tempFilePath: 'temp_file_path', + success: (res) => { + console.log('保存成功', res.savedFilePath) + } +}) +``` + +## 完整示例 + +### 示例 1: 保存临时文件 + +```javascript +uni.saveFile({ + tempFilePath: 'temp_file_path', + success: (res) => { + console.log('保存成功', res.savedFilePath) + uni.showToast({ + title: '保存成功', + icon: 'success' + }) + }, + fail: (err) => { + console.error('保存失败', err) + } +}) +``` + +### 示例 2: 保存下载的文件 + +```javascript +uni.downloadFile({ + url: 'https://example.com/file.pdf', + success: (res) => { + if (res.statusCode === 200) { + // 保存下载的文件 + uni.saveFile({ + tempFilePath: res.tempFilePath, + success: (saveRes) => { + console.log('文件已保存', saveRes.savedFilePath) + } + }) + } + } +}) +``` + +### 示例 3: 保存图片到本地 + +```javascript +uni.chooseImage({ + count: 1, + success: (res) => { + const tempFilePath = res.tempFilePaths[0] + + // 保存图片 + uni.saveFile({ + tempFilePath: tempFilePath, + success: (saveRes) => { + console.log('图片已保存', saveRes.savedFilePath) + uni.showToast({ + title: '保存成功', + icon: 'success' + }) + } + }) + } +}) +``` + +### 示例 4: 在页面中使用 + +```vue + + + +``` + +### 示例 5: 保存多个文件 + +```javascript +function saveMultipleFiles(tempFilePaths) { + const savedFilePaths = [] + let completedCount = 0 + + tempFilePaths.forEach((tempFilePath, index) => { + uni.saveFile({ + tempFilePath: tempFilePath, + success: (res) => { + savedFilePaths[index] = res.savedFilePath + completedCount++ + + if (completedCount === tempFilePaths.length) { + console.log('所有文件已保存', savedFilePaths) + uni.showToast({ + title: '全部保存成功', + icon: 'success' + }) + } + }, + fail: (err) => { + console.error(`文件${index + 1}保存失败`, err) + completedCount++ + } + }) + }) +} + +// 使用 +uni.chooseImage({ + count: 3, + success: (res) => { + saveMultipleFiles(res.tempFilePaths) + } +}) +``` + +## 参数说明 + +| 参数名 | 类型 | 必填 | 说明 | +|--------|------|------|------| +| tempFilePath | String | 是 | 需要保存的文件的临时路径 | + +## 返回值 + +| 参数名 | 类型 | 说明 | +|--------|------|------| +| savedFilePath | String | 文件的保存路径 | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ❌ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. H5 平台不支持此 API +2. 保存的文件可以通过 `uni.getSavedFileList` 获取列表 +3. 保存的文件可以通过 `uni.removeSavedFile` 删除 +4. 建议在保存前检查文件大小 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/file/file.html#savefile +- **获取文件列表**: https://doc.dcloud.net.cn/uni-app-x/api/file/file.html#getsavedfilelist +- **删除文件**: https://doc.dcloud.net.cn/uni-app-x/api/file/file.html#removesavedfile diff --git a/.agents/bak-skills/uniappx-project/examples/api/location/choose-location.md b/.agents/bak-skills/uniappx-project/examples/api/location/choose-location.md new file mode 100644 index 0000000..e04430a --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/location/choose-location.md @@ -0,0 +1,299 @@ +# uni.chooseLocation - 选择位置示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/location/choose-location.html#chooselocation + +## 概述 + +`uni.chooseLocation` 用于打开地图选择位置。 + +## 基础用法 + +```javascript +uni.chooseLocation({ + success: (res) => { + console.log('选择的位置', res.name, res.address) + } +}) +``` + +## 完整示例 + +### 示例 1: 基本选择位置 + +```javascript +uni.chooseLocation({ + success: (res) => { + console.log('位置名称', res.name) + console.log('详细地址', res.address) + console.log('纬度', res.latitude) + console.log('经度', res.longitude) + }, + fail: (err) => { + console.error('选择失败', err) + } +}) +``` + +### 示例 2: 在页面中使用 + +```vue + + + +``` + +### 示例 3: 选择收货地址 + +```vue + + + + + +``` + +### 示例 4: 检查权限 + +```javascript +function chooseLocationWithPermission() { + // 先检查权限 + uni.getSetting({ + success: (res) => { + if (res.authSetting['scope.userLocation']) { + // 已授权,直接选择 + chooseLocation() + } else { + // 请求授权 + uni.authorize({ + scope: 'scope.userLocation', + success: () => { + chooseLocation() + }, + fail: () => { + uni.showModal({ + title: '提示', + content: '需要位置权限才能选择位置', + success: (modalRes) => { + if (modalRes.confirm) { + uni.openSetting() + } + } + }) + } + }) + } + } + }) +} + +function chooseLocation() { + uni.chooseLocation({ + success: (res) => { + console.log('选择的位置', res) + } + }) +} +``` + +### 示例 5: 在地图上显示选择的位置 + +```vue + + + + + +``` + +## 返回值 + +| 参数名 | 类型 | 说明 | +|--------|------|------| +| name | String | 位置名称 | +| address | String | 详细地址 | +| latitude | Number | 纬度 | +| longitude | Number | 经度 | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ❌ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. 需要用户授权位置权限 +2. H5 平台不支持此 API +3. 选择的位置包含名称、地址和坐标信息 +4. 建议在需要时再请求权限 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/location/choose-location.html#chooselocation +- **获取位置**: https://doc.dcloud.net.cn/uni-app-x/api/location/location.html#getlocation +- **打开地图**: https://doc.dcloud.net.cn/uni-app-x/api/location/open-location.html#openlocation diff --git a/.agents/bak-skills/uniappx-project/examples/api/location/get-location.md b/.agents/bak-skills/uniappx-project/examples/api/location/get-location.md new file mode 100644 index 0000000..2ac658f --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/location/get-location.md @@ -0,0 +1,243 @@ +# uni.getLocation - 获取位置示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/location/location.html#getlocation + +## 概述 + +`uni.getLocation` 用于获取当前地理位置。 + +## 基础用法 + +```javascript +uni.getLocation({ + type: 'wgs84', + success: (res) => { + console.log('当前位置', res.latitude, res.longitude) + } +}) +``` + +## 完整示例 + +### 示例 1: 获取当前位置 + +```javascript +uni.getLocation({ + type: 'wgs84', + success: (res) => { + console.log('纬度', res.latitude) + console.log('经度', res.longitude) + console.log('速度', res.speed) + console.log('精度', res.accuracy) + }, + fail: (err) => { + console.error('获取位置失败', err) + } +}) +``` + +### 示例 2: 高精度定位 + +```javascript +uni.getLocation({ + type: 'gcj02', + altitude: true, + geocode: true, + success: (res) => { + console.log('位置信息', res) + // res.address 包含地址信息(需要 geocode: true) + } +}) +``` + +### 示例 3: 在页面中使用 + +```vue + + + +``` + +### 示例 4: 检查定位权限 + +```javascript +// 先检查定位权限 +uni.getSetting({ + success: (res) => { + if (res.authSetting['scope.userLocation']) { + // 已授权,直接获取位置 + uni.getLocation({ + type: 'gcj02', + success: (res) => { + console.log('位置', res) + } + }) + } else { + // 未授权,请求授权 + uni.authorize({ + scope: 'scope.userLocation', + success: () => { + uni.getLocation({ + type: 'gcj02', + success: (res) => { + console.log('位置', res) + } + }) + }, + fail: () => { + uni.showModal({ + title: '提示', + content: '需要定位权限才能使用此功能', + showCancel: false + }) + } + }) + } + } +}) +``` + +### 示例 5: 在地图上显示位置 + +```vue + + + + + +``` + +## 参数说明 + +| 参数名 | 类型 | 必填 | 说明 | +|--------|------|------|------| +| type | String | 否 | 坐标类型,可选值:wgs84、gcj02 | +| altitude | Boolean | 否 | 是否返回高度信息 | +| geocode | Boolean | 否 | 是否解析地址信息 | + +## 返回值 + +| 参数名 | 类型 | 说明 | +|--------|------|------| +| latitude | Number | 纬度 | +| longitude | Number | 经度 | +| speed | Number | 速度 | +| accuracy | Number | 位置的精确度 | +| altitude | Number | 高度(需要 altitude: true) | +| address | Object | 地址信息(需要 geocode: true) | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅(需要 HTTPS) | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. 需要用户授权定位权限 +2. H5 平台需要 HTTPS 协议 +3. `type` 为 `gcj02` 时返回的坐标可用于地图显示 +4. `geocode` 为 true 时才能获取地址信息 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/location/location.html#getlocation +- **打开地图**: https://doc.dcloud.net.cn/uni-app-x/api/location/location.html#openlocation +- **选择位置**: https://doc.dcloud.net.cn/uni-app-x/api/location/location.html#chooselocation diff --git a/.agents/bak-skills/uniappx-project/examples/api/location/open-location.md b/.agents/bak-skills/uniappx-project/examples/api/location/open-location.md new file mode 100644 index 0000000..db3c943 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/location/open-location.md @@ -0,0 +1,188 @@ +# uni.openLocation - 打开地图查看位置示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/location/open-location.html#openlocation + +## 概述 + +`uni.openLocation` 用于使用地图查看位置,可以打开系统地图应用显示指定位置。 + +## 基础用法 + +```javascript +uni.openLocation({ + latitude: 39.908823, + longitude: 116.397470, + name: '天安门', + address: '北京市东城区' +}) +``` + +## 完整示例 + +### 示例 1: 打开地图查看位置 + +```javascript +uni.openLocation({ + latitude: 39.908823, + longitude: 116.397470, + name: '天安门', + address: '北京市东城区天安门广场', + scale: 18, + success: () => { + console.log('打开地图成功') + }, + fail: (err) => { + console.error('打开地图失败', err) + } +}) +``` + +### 示例 2: 先获取位置再打开地图 + +```javascript +// 先获取当前位置 +uni.getLocation({ + type: 'gcj02', + success: (locationRes) => { + // 打开地图显示当前位置 + uni.openLocation({ + latitude: locationRes.latitude, + longitude: locationRes.longitude, + name: '我的位置', + address: locationRes.address || '当前位置' + }) + } +}) +``` + +### 示例 3: 在页面中使用 + +```vue + + + +``` + +### 示例 4: 查看商家位置 + +```javascript +function openStoreLocation(store) { + uni.openLocation({ + latitude: store.latitude, + longitude: store.longitude, + name: store.name, + address: store.address, + scale: 18, + success: () => { + console.log('打开商家位置成功') + } + }) +} + +// 使用 +const store = { + name: '星巴克咖啡', + address: '北京市朝阳区xxx路xxx号', + latitude: 39.908823, + longitude: 116.397470 +} +openStoreLocation(store) +``` + +### 示例 5: 导航到位置 + +```javascript +// 在某些平台上,openLocation 可以用于导航 +uni.openLocation({ + latitude: 39.908823, + longitude: 116.397470, + name: '目的地', + address: '北京市东城区', + scale: 18 +}) +``` + +## 参数说明 + +| 参数名 | 类型 | 必填 | 说明 | +|--------|------|------|------| +| latitude | Number | 是 | 纬度,范围为 -90~90,负数表示南纬 | +| longitude | Number | 是 | 经度,范围为 -180~180,负数表示西经 | +| scale | Number | 否 | 缩放比例,范围 5~18,默认为 18 | +| name | String | 否 | 位置名称 | +| address | String | 否 | 地址的详细说明 | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. 需要使用 `gcj02` 类型的坐标(通过 `uni.getLocation` 获取) +2. `scale` 值越大,地图显示越详细 +3. `name` 和 `address` 用于在地图上显示位置信息 +4. 不同平台打开的地图应用可能不同 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/location/open-location.html#openlocation +- **获取位置**: https://doc.dcloud.net.cn/uni-app-x/api/location/location.html#getlocation diff --git a/.agents/bak-skills/uniappx-project/examples/api/media/choose-image.md b/.agents/bak-skills/uniappx-project/examples/api/media/choose-image.md new file mode 100644 index 0000000..3d91a2b --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/media/choose-image.md @@ -0,0 +1,222 @@ +# uni.chooseImage - 选择图片示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/media/image.html#chooseimage + +## 概述 + +`uni.chooseImage` 用于从本地相册选择图片或使用相机拍照。 + +## 基础用法 + +```javascript +uni.chooseImage({ + count: 1, + success: (res) => { + console.log('选择的图片', res.tempFilePaths) + } +}) +``` + +## 完整示例 + +### 示例 1: 选择单张图片 + +```javascript +uni.chooseImage({ + count: 1, + sizeType: ['original', 'compressed'], + sourceType: ['album', 'camera'], + success: (res) => { + console.log('选择的图片路径', res.tempFilePaths) + console.log('图片文件信息', res.tempFiles) + } +}) +``` + +### 示例 2: 选择多张图片 + +```javascript +uni.chooseImage({ + count: 9, // 最多选择9张 + sizeType: ['compressed'], // 只选择压缩图 + sourceType: ['album'], // 只从相册选择 + success: (res) => { + console.log('选择了', res.tempFilePaths.length, '张图片') + res.tempFilePaths.forEach((path, index) => { + console.log(`图片${index + 1}:`, path) + }) + } +}) +``` + +### 示例 3: 在页面中使用 + +```vue + + + + + +``` + +### 示例 4: 上传图片 + +```javascript +uni.chooseImage({ + count: 1, + sizeType: ['compressed'], + sourceType: ['album', 'camera'], + success: (res) => { + const tempFilePath = res.tempFilePaths[0] + + // 上传图片 + uni.uploadFile({ + url: 'https://api.example.com/upload', + filePath: tempFilePath, + name: 'file', + success: (uploadRes) => { + const data = JSON.parse(uploadRes.data) + console.log('上传成功', data.url) + uni.showToast({ + title: '上传成功', + icon: 'success' + }) + }, + fail: (err) => { + console.error('上传失败', err) + uni.showToast({ + title: '上传失败', + icon: 'none' + }) + } + }) + } +}) +``` + +### 示例 5: 获取图片信息 + +```javascript +uni.chooseImage({ + count: 1, + success: (res) => { + const tempFilePath = res.tempFilePaths[0] + + // 获取图片信息 + uni.getImageInfo({ + src: tempFilePath, + success: (imageInfo) => { + console.log('图片宽度', imageInfo.width) + console.log('图片高度', imageInfo.height) + console.log('图片路径', imageInfo.path) + } + }) + } +}) +``` + +## 参数说明 + +| 参数名 | 类型 | 必填 | 说明 | +|--------|------|------|------| +| count | Number | 否 | 最多可以选择的图片张数,默认 9 | +| sizeType | Array | 否 | 所选的图片的尺寸,可选值:original(原图)、compressed(压缩图) | +| sourceType | Array | 否 | 选择图片的来源,可选值:album(相册)、camera(相机) | + +## 返回值 + +| 参数名 | 类型 | 说明 | +|--------|------|------| +| tempFilePaths | Array | 图片的本地文件路径列表 | +| tempFiles | Array | 图片的本地文件列表,每个文件包含 path 和 size | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. 选择的图片是临时文件,需要上传到服务器才能永久保存 +2. 临时文件路径在不同平台格式可能不同 +3. 选择图片需要用户授权,首次使用会弹出授权提示 +4. 建议使用压缩图以节省存储空间 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/media/image.html#chooseimage +- **预览图片**: https://doc.dcloud.net.cn/uni-app-x/api/media/image.html#previewimage +- **上传文件**: https://doc.dcloud.net.cn/uni-app-x/api/request/network-file.html#uploadfile diff --git a/.agents/bak-skills/uniappx-project/examples/api/media/choose-media.md b/.agents/bak-skills/uniappx-project/examples/api/media/choose-media.md new file mode 100644 index 0000000..3114818 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/media/choose-media.md @@ -0,0 +1,232 @@ +# uni.chooseMedia - 选择媒体文件示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/media/video.html#choosemedia + +## 概述 + +`uni.chooseMedia` 用于从本地相册选择图片或视频,或者使用相机拍摄图片或视频。 + +## 基础用法 + +```javascript +uni.chooseMedia({ + count: 9, + success: (res) => { + console.log('选择的文件', res.tempFiles) + } +}) +``` + +## 完整示例 + +### 示例 1: 选择图片和视频 + +```javascript +uni.chooseMedia({ + count: 9, + mediaType: ['image', 'video'], + sourceType: ['album', 'camera'], + success: (res) => { + console.log('选择的文件', res.tempFiles) + res.tempFiles.forEach((file, index) => { + console.log(`文件${index + 1}:`, file.tempFilePath) + if (file.fileType === 'image') { + console.log('图片大小', file.size) + } else if (file.fileType === 'video') { + console.log('视频时长', file.duration) + } + }) + } +}) +``` + +### 示例 2: 只选择图片 + +```javascript +uni.chooseMedia({ + count: 9, + mediaType: ['image'], + sourceType: ['album', 'camera'], + sizeType: ['original', 'compressed'], + success: (res) => { + console.log('选择的图片', res.tempFiles) + } +}) +``` + +### 示例 3: 只选择视频 + +```javascript +uni.chooseMedia({ + count: 1, + mediaType: ['video'], + sourceType: ['album', 'camera'], + maxDuration: 60, + camera: 'back', + success: (res) => { + console.log('选择的视频', res.tempFiles) + } +}) +``` + +### 示例 4: 在页面中使用 + +```vue + + + + + +``` + +### 示例 5: 上传媒体文件 + +```javascript +uni.chooseMedia({ + count: 9, + mediaType: ['image', 'video'], + success: (res) => { + const files = res.tempFiles + let uploadCount = 0 + + files.forEach((file, index) => { + uni.uploadFile({ + url: 'https://api.example.com/upload', + filePath: file.tempFilePath, + name: 'file', + formData: { + fileType: file.fileType, + size: file.size + }, + success: (uploadRes) => { + uploadCount++ + console.log(`文件${index + 1}上传成功`) + + if (uploadCount === files.length) { + uni.showToast({ + title: '全部上传成功', + icon: 'success' + }) + } + }, + fail: (err) => { + console.error(`文件${index + 1}上传失败`, err) + } + }) + }) + } +}) +``` + +## 参数说明 + +| 参数名 | 类型 | 必填 | 说明 | +|--------|------|------|------| +| count | Number | 否 | 最多可以选择的文件个数,默认 9 | +| mediaType | Array | 否 | 文件类型,可选值:image、video | +| sourceType | Array | 否 | 选择文件来源,可选值:album、camera | +| maxDuration | Number | 否 | 拍摄视频最长拍摄时间,单位秒 | +| camera | String | 否 | 使用前置或后置摄像头,可选值:back、front | + +## 返回值 + +| 参数名 | 类型 | 说明 | +|--------|------|------| +| tempFiles | Array | 选中的文件列表,每个文件包含 tempFilePath、size、fileType 等 | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. `mediaType` 可以同时选择图片和视频 +2. `count` 表示最多可以选择的文件个数 +3. 返回的文件包含 `fileType` 字段,用于区分图片和视频 +4. 建议根据实际需求设置 `maxDuration` 限制视频时长 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/media/video.html#choosemedia +- **选择图片**: https://doc.dcloud.net.cn/uni-app-x/api/media/image.html#chooseimage +- **选择视频**: https://doc.dcloud.net.cn/uni-app-x/api/media/video.html#choosevideo diff --git a/.agents/bak-skills/uniappx-project/examples/api/media/choose-video.md b/.agents/bak-skills/uniappx-project/examples/api/media/choose-video.md new file mode 100644 index 0000000..a2c1764 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/media/choose-video.md @@ -0,0 +1,233 @@ +# uni.chooseVideo - 选择视频示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/media/video.html#choosevideo + +## 概述 + +`uni.chooseVideo` 用于从本地相册选择视频或使用相机拍摄视频。 + +## 基础用法 + +```javascript +uni.chooseVideo({ + success: (res) => { + console.log('选择的视频', res.tempFilePath) + } +}) +``` + +## 完整示例 + +### 示例 1: 选择视频 + +```javascript +uni.chooseVideo({ + sourceType: ['album', 'camera'], + maxDuration: 60, + camera: 'back', + success: (res) => { + console.log('视频路径', res.tempFilePath) + console.log('视频时长', res.duration, '秒') + console.log('视频大小', res.size, '字节') + console.log('视频高度', res.height) + console.log('视频宽度', res.width) + } +}) +``` + +### 示例 2: 拍摄视频 + +```javascript +uni.chooseVideo({ + sourceType: ['camera'], + maxDuration: 30, + camera: 'back', + success: (res) => { + console.log('拍摄的视频', res.tempFilePath) + // 可以预览或上传视频 + } +}) +``` + +### 示例 3: 在页面中使用 + +```vue + + + + + +``` + +### 示例 4: 上传视频 + +```javascript +uni.chooseVideo({ + sourceType: ['album', 'camera'], + maxDuration: 60, + success: (res) => { + const tempFilePath = res.tempFilePath + + // 上传视频 + uni.uploadFile({ + url: 'https://api.example.com/upload-video', + filePath: tempFilePath, + name: 'video', + formData: { + duration: res.duration, + size: res.size + }, + success: (uploadRes) => { + const data = JSON.parse(uploadRes.data) + console.log('上传成功', data.url) + uni.showToast({ + title: '上传成功', + icon: 'success' + }) + }, + fail: (err) => { + console.error('上传失败', err) + } + }) + } +}) +``` + +### 示例 5: 限制视频时长和大小 + +```javascript +uni.chooseVideo({ + sourceType: ['album', 'camera'], + maxDuration: 30, // 最长30秒 + success: (res) => { + // 检查视频大小(例如限制为50MB) + const maxSize = 50 * 1024 * 1024 // 50MB + if (res.size > maxSize) { + uni.showModal({ + title: '提示', + content: '视频文件过大,请选择小于50MB的视频', + showCancel: false + }) + return + } + + // 检查视频时长 + if (res.duration > 30) { + uni.showModal({ + title: '提示', + content: '视频时长不能超过30秒', + showCancel: false + }) + return + } + + console.log('视频符合要求', res) + } +}) +``` + +## 参数说明 + +| 参数名 | 类型 | 必填 | 说明 | +|--------|------|------|------| +| sourceType | Array | 否 | 选择视频的来源,可选值:album(相册)、camera(相机) | +| maxDuration | Number | 否 | 拍摄视频最长拍摄时间,单位秒 | +| camera | String | 否 | 使用前置或后置摄像头,可选值:back、front | + +## 返回值 + +| 参数名 | 类型 | 说明 | +|--------|------|------| +| tempFilePath | String | 选定视频的临时文件路径 | +| duration | Number | 选定视频的时间长度,单位秒 | +| size | Number | 选定视频的数据量大小,单位字节 | +| width | Number | 选定视频的宽度,单位 px | +| height | Number | 选定视频的高度,单位 px | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. 选择的视频是临时文件,需要上传到服务器才能永久保存 +2. `maxDuration` 用于限制拍摄时长 +3. 可以通过 `size` 检查视频文件大小 +4. 建议在拍摄前提示用户视频时长限制 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/media/video.html#choosevideo +- **上传文件**: https://doc.dcloud.net.cn/uni-app-x/api/request/network-file.html#uploadfile diff --git a/.agents/bak-skills/uniappx-project/examples/api/media/get-image-info.md b/.agents/bak-skills/uniappx-project/examples/api/media/get-image-info.md new file mode 100644 index 0000000..56396a5 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/media/get-image-info.md @@ -0,0 +1,209 @@ +# uni.getImageInfo - 获取图片信息示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/media/image.html#getimageinfo + +## 概述 + +`uni.getImageInfo` 用于获取图片信息,包括宽度、高度、路径等。 + +## 基础用法 + +```javascript +uni.getImageInfo({ + src: 'https://example.com/image.jpg', + success: (res) => { + console.log('图片宽度', res.width) + console.log('图片高度', res.height) + } +}) +``` + +## 完整示例 + +### 示例 1: 获取网络图片信息 + +```javascript +uni.getImageInfo({ + src: 'https://example.com/image.jpg', + success: (res) => { + console.log('图片宽度', res.width) + console.log('图片高度', res.height) + console.log('图片路径', res.path) + }, + fail: (err) => { + console.error('获取失败', err) + } +}) +``` + +### 示例 2: 获取本地图片信息 + +```javascript +// 先选择图片 +uni.chooseImage({ + count: 1, + success: (res) => { + const tempFilePath = res.tempFilePaths[0] + + // 获取图片信息 + uni.getImageInfo({ + src: tempFilePath, + success: (imageInfo) => { + console.log('图片信息', imageInfo) + // { width: 800, height: 600, path: '...' } + } + }) + } +}) +``` + +### 示例 3: 在页面中使用 + +```vue + + + + + +``` + +### 示例 4: 计算图片宽高比 + +```javascript +uni.getImageInfo({ + src: 'https://example.com/image.jpg', + success: (res) => { + const aspectRatio = res.width / res.height + console.log('宽高比', aspectRatio) + + // 根据宽高比调整显示 + if (aspectRatio > 1) { + console.log('横向图片') + } else { + console.log('纵向图片') + } + } +}) +``` + +### 示例 5: 验证图片尺寸 + +```javascript +function validateImageSize(imagePath, minWidth, minHeight) { + return new Promise((resolve, reject) => { + uni.getImageInfo({ + src: imagePath, + success: (res) => { + if (res.width >= minWidth && res.height >= minHeight) { + resolve(res) + } else { + reject(new Error(`图片尺寸不符合要求,需要至少 ${minWidth}x${minHeight}`)) + } + }, + fail: (err) => { + reject(err) + } + }) + }) +} + +// 使用 +validateImageSize('https://example.com/image.jpg', 800, 600) + .then(info => { + console.log('图片符合要求', info) + }) + .catch(err => { + console.error('验证失败', err) + }) +``` + +## 参数说明 + +| 参数名 | 类型 | 必填 | 说明 | +|--------|------|------|------| +| src | String | 是 | 图片的路径,可以是相对路径、临时文件路径或网络图片路径 | + +## 返回值 + +| 参数名 | 类型 | 说明 | +|--------|------|------| +| width | Number | 图片宽度,单位 px | +| height | Number | 图片高度,单位 px | +| path | String | 返回图片的本地路径 | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. 网络图片需要配置合法域名 +2. 本地图片路径需要使用 `/static/` 开头或临时文件路径 +3. 获取图片信息是异步操作 +4. 可以用于验证图片尺寸、计算宽高比等 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/media/image.html#getimageinfo +- **选择图片**: https://doc.dcloud.net.cn/uni-app-x/api/media/image.html#chooseimage diff --git a/.agents/bak-skills/uniappx-project/examples/api/media/preview-image.md b/.agents/bak-skills/uniappx-project/examples/api/media/preview-image.md new file mode 100644 index 0000000..91628b1 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/media/preview-image.md @@ -0,0 +1,234 @@ +# uni.previewImage - 预览图片示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/media/image.html#previewimage + +## 概述 + +`uni.previewImage` 用于预览图片,支持缩放、滑动查看多张图片。 + +## 基础用法 + +```javascript +uni.previewImage({ + urls: ['https://example.com/image1.jpg'], + current: 0 +}) +``` + +## 完整示例 + +### 示例 1: 预览单张图片 + +```javascript +uni.previewImage({ + urls: ['https://example.com/image1.jpg'], + current: 'https://example.com/image1.jpg' +}) +``` + +### 示例 2: 预览多张图片 + +```javascript +const imageList = [ + 'https://example.com/image1.jpg', + 'https://example.com/image2.jpg', + 'https://example.com/image3.jpg' +] + +uni.previewImage({ + urls: imageList, + current: 0 // 从第一张开始 +}) +``` + +### 示例 3: 在页面中使用 + +```vue + + + + + +``` + +### 示例 4: 从选择图片到预览 + +```vue + + + +``` + +### 示例 5: 长按保存图片 + +```vue + + + +``` + +## 参数说明 + +| 参数名 | 类型 | 必填 | 说明 | +|--------|------|------|------| +| urls | Array | 是 | 需要预览的图片 http 链接列表 | +| current | String/Number | 否 | 当前显示图片的索引或链接 | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. `urls` 必须是网络图片或已下载的本地路径 +2. `current` 可以是索引(Number)或图片链接(String) +3. 预览时支持手势缩放和滑动切换 +4. 建议使用网络图片时确保图片可访问 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/media/image.html#previewimage +- **选择图片**: https://doc.dcloud.net.cn/uni-app-x/api/media/image.html#chooseimage diff --git a/.agents/bak-skills/uniappx-project/examples/api/media/save-image-to-photos-album.md b/.agents/bak-skills/uniappx-project/examples/api/media/save-image-to-photos-album.md new file mode 100644 index 0000000..e672ac0 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/media/save-image-to-photos-album.md @@ -0,0 +1,274 @@ +# uni.saveImageToPhotosAlbum - 保存图片到相册示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/media/image.html#saveimagetophotosalbum + +## 概述 + +`uni.saveImageToPhotosAlbum` 用于保存图片到系统相册。 + +## 基础用法 + +```javascript +uni.saveImageToPhotosAlbum({ + filePath: '/tmp/image.jpg', + success: () => { + console.log('保存成功') + } +}) +``` + +## 完整示例 + +### 示例 1: 保存网络图片 + +```javascript +// 先下载图片 +uni.downloadFile({ + url: 'https://example.com/image.jpg', + success: (res) => { + if (res.statusCode === 200) { + // 保存到相册 + uni.saveImageToPhotosAlbum({ + filePath: res.tempFilePath, + success: () => { + uni.showToast({ + title: '保存成功', + icon: 'success' + }) + }, + fail: (err) => { + console.error('保存失败', err) + if (err.errMsg.includes('auth deny')) { + uni.showModal({ + title: '提示', + content: '需要相册权限才能保存图片', + showCancel: false + }) + } + } + }) + } + } +}) +``` + +### 示例 2: 保存选择的图片 + +```javascript +uni.chooseImage({ + count: 1, + success: (res) => { + const tempFilePath = res.tempFilePaths[0] + + uni.saveImageToPhotosAlbum({ + filePath: tempFilePath, + success: () => { + uni.showToast({ + title: '保存成功', + icon: 'success' + }) + }, + fail: (err) => { + console.error('保存失败', err) + } + }) + } +}) +``` + +### 示例 3: 在页面中使用 + +```vue + + + +``` + +### 示例 4: 检查权限 + +```javascript +function saveImageWithPermission(filePath) { + // 先检查权限 + uni.getSetting({ + success: (res) => { + if (res.authSetting['scope.writePhotosAlbum']) { + // 已授权,直接保存 + saveImage(filePath) + } else { + // 请求授权 + uni.authorize({ + scope: 'scope.writePhotosAlbum', + success: () => { + saveImage(filePath) + }, + fail: () => { + uni.showModal({ + title: '提示', + content: '需要相册权限才能保存图片', + success: (modalRes) => { + if (modalRes.confirm) { + uni.openSetting() + } + } + }) + } + }) + } + } + }) +} + +function saveImage(filePath) { + uni.saveImageToPhotosAlbum({ + filePath: filePath, + success: () => { + uni.showToast({ + title: '保存成功', + icon: 'success' + }) + } + }) +} +``` + +### 示例 5: 长按保存图片 + +```vue + + + +``` + +## 参数说明 + +| 参数名 | 类型 | 必填 | 说明 | +|--------|------|------|------| +| filePath | String | 是 | 图片文件路径,可以是临时文件路径或永久文件路径 | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. 需要用户授权相册权限 +2. 网络图片需要先下载到本地 +3. 如果权限被拒绝,可以引导用户到设置中开启 +4. 建议在保存前检查权限状态 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/media/image.html#saveimagetophotosalbum +- **下载文件**: https://doc.dcloud.net.cn/uni-app-x/api/request/network-file.html#downloadfile +- **授权**: https://doc.dcloud.net.cn/uni-app-x/api/other/authorize.html#authorize diff --git a/.agents/bak-skills/uniappx-project/examples/api/navigation/navigate-back.md b/.agents/bak-skills/uniappx-project/examples/api/navigation/navigate-back.md new file mode 100644 index 0000000..41c3c7d --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/navigation/navigate-back.md @@ -0,0 +1,177 @@ +# uni.navigateBack - 返回上一页示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/router.html#navigateback + +## 概述 + +`uni.navigateBack` 用于关闭当前页面,返回上一页面或多级页面。 + +## 基础用法 + +```javascript +uni.navigateBack() +``` + +## 完整示例 + +### 示例 1: 基本返回 + +```javascript +uni.navigateBack({ + success: () => { + console.log('返回成功') + }, + fail: (err) => { + console.error('返回失败', err) + } +}) +``` + +### 示例 2: 返回多级页面 + +```javascript +// 返回上一页 +uni.navigateBack({ + delta: 1 +}) + +// 返回上两页 +uni.navigateBack({ + delta: 2 +}) +``` + +### 示例 3: 在页面中使用 + +```vue + + + +``` + +### 示例 4: 带数据返回 + +```vue + + + + +``` + +### 示例 5: 返回前确认 + +```vue + + + +``` + +## 参数说明 + +| 参数名 | 类型 | 必填 | 说明 | +|--------|------|------|------| +| delta | Number | 否 | 返回的页面数,如果 delta 大于现有页面数,则返回到首页 | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. `delta` 默认为 1,表示返回上一页 +2. 如果 `delta` 大于现有页面数,会返回到首页 +3. 可以通过 `getCurrentPages()` 获取页面栈信息 +4. 返回时可以传递数据给上一页 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/router.html#navigateback +- **页面跳转**: https://doc.dcloud.net.cn/uni-app-x/api/router.html#navigateto diff --git a/.agents/bak-skills/uniappx-project/examples/api/navigation/navigate-to.md b/.agents/bak-skills/uniappx-project/examples/api/navigation/navigate-to.md new file mode 100644 index 0000000..b905150 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/navigation/navigate-to.md @@ -0,0 +1,151 @@ +# uni.navigateTo - 页面跳转示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/router.html#navigateto + +## 概述 + +`uni.navigateTo` 用于保留当前页面,跳转到应用内的某个页面。 + +## 基础用法 + +```javascript +uni.navigateTo({ + url: '/pages/detail/detail' +}) +``` + +## 完整示例 + +### 示例 1: 基本跳转 + +```javascript +uni.navigateTo({ + url: '/pages/detail/detail', + success: () => { + console.log('跳转成功') + }, + fail: (err) => { + console.error('跳转失败', err) + } +}) +``` + +### 示例 2: 带参数跳转 + +```javascript +// 跳转并传递参数 +uni.navigateTo({ + url: '/pages/detail/detail?id=123&name=test' +}) + +// 在目标页面接收参数 +// pages/detail/detail.vue +export default { + onLoad(options) { + console.log('接收到的参数', options) + // { id: '123', name: 'test' } + } +} +``` + +### 示例 3: 传递对象参数 + +```javascript +// 传递对象 +const params = { + id: 123, + name: 'test', + data: { key: 'value' } +} + +// 需要序列化 +uni.navigateTo({ + url: `/pages/detail/detail?data=${encodeURIComponent(JSON.stringify(params))}` +}) + +// 在目标页面解析 +export default { + onLoad(options) { + const data = JSON.parse(decodeURIComponent(options.data)) + console.log('解析后的数据', data) + } +} +``` + +### 示例 4: 在组件中使用 + +```vue + + + +``` + +### 示例 5: 封装跳转函数 + +```javascript +// utils/navigation.js +const navigation = { + // 跳转到详情页 + toDetail(id) { + uni.navigateTo({ + url: `/pages/detail/detail?id=${id}` + }) + }, + + // 跳转到用户页 + toUser(userId) { + uni.navigateTo({ + url: `/pages/user/user?id=${userId}` + }) + }, + + // 通用跳转 + navigate(url, params = {}) { + const query = Object.keys(params) + .map(key => `${key}=${encodeURIComponent(params[key])}`) + .join('&') + const fullUrl = query ? `${url}?${query}` : url + uni.navigateTo({ + url: fullUrl + }) + } +} + +// 使用 +navigation.toDetail(123) +navigation.navigate('/pages/detail/detail', { id: 123, name: 'test' }) +``` + +## 注意事项 + +1. 不能跳转到 tabBar 页面,需要使用 `uni.switchTab` +2. 路径前需要加 `/`,表示从根目录开始 +3. 参数会拼接在 URL 后面,长度有限制 +4. 复杂对象需要序列化后传递 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/router.html#navigateto +- **其他路由 API**: https://doc.dcloud.net.cn/uni-app-x/api/router.html diff --git a/.agents/bak-skills/uniappx-project/examples/api/navigation/re-launch.md b/.agents/bak-skills/uniappx-project/examples/api/navigation/re-launch.md new file mode 100644 index 0000000..a13e732 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/navigation/re-launch.md @@ -0,0 +1,152 @@ +# uni.reLaunch - 重新启动应用示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/router.html#relaunch + +## 概述 + +`uni.reLaunch` 用于关闭所有页面,打开到应用内的某个页面。 + +## 基础用法 + +```javascript +uni.reLaunch({ + url: '/pages/index/index' +}) +``` + +## 完整示例 + +### 示例 1: 基本重新启动 + +```javascript +uni.reLaunch({ + url: '/pages/index/index', + success: () => { + console.log('重新启动成功') + }, + fail: (err) => { + console.error('重新启动失败', err) + } +}) +``` + +### 示例 2: 退出登录后重新启动 + +```javascript +function logout() { + // 清除所有数据 + uni.clearStorageSync() + + // 重新启动到登录页 + uni.reLaunch({ + url: '/pages/login/login' + }) +} +``` + +### 示例 3: 在页面中使用 + +```vue + + + +``` + +### 示例 4: 与 navigateTo 和 redirectTo 的区别 + +```javascript +// navigateTo: 保留当前页面,可以返回 +uni.navigateTo({ + url: '/pages/detail/detail' +}) +// 页面栈: [首页, 详情页] + +// redirectTo: 关闭当前页面,不能返回 +uni.redirectTo({ + url: '/pages/detail/detail' +}) +// 页面栈: [详情页] (首页被关闭) + +// reLaunch: 关闭所有页面,重新启动 +uni.reLaunch({ + url: '/pages/detail/detail' +}) +// 页面栈: [详情页] (所有页面都被关闭) +``` + +### 示例 5: 登录后重新启动 + +```javascript +function login() { + uni.request({ + url: 'https://api.example.com/login', + method: 'POST', + data: { username: 'test', password: '123456' }, + success: (res) => { + if (res.data.success) { + uni.setStorageSync('token', res.data.token) + // 重新启动到首页 + uni.reLaunch({ + url: '/pages/index/index' + }) + } + } + }) +} +``` + +## 参数说明 + +| 参数名 | 类型 | 必填 | 说明 | +|--------|------|------|------| +| url | String | 是 | 需要跳转的应用内非 tabBar 的页面的路径 | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. 不能跳转到 tabBar 页面,需要使用 `uni.switchTab` +2. 会关闭所有页面,无法返回 +3. 路径前需要加 `/`,表示从根目录开始 +4. 适合退出登录、重新启动等场景 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/router.html#relaunch +- **页面跳转**: https://doc.dcloud.net.cn/uni-app-x/api/router.html#navigateto diff --git a/.agents/bak-skills/uniappx-project/examples/api/navigation/redirect-to.md b/.agents/bak-skills/uniappx-project/examples/api/navigation/redirect-to.md new file mode 100644 index 0000000..39e515f --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/navigation/redirect-to.md @@ -0,0 +1,146 @@ +# uni.redirectTo - 重定向跳转示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/router.html#redirectto + +## 概述 + +`uni.redirectTo` 用于关闭当前页面,跳转到应用内的某个页面。 + +## 基础用法 + +```javascript +uni.redirectTo({ + url: '/pages/detail/detail' +}) +``` + +## 完整示例 + +### 示例 1: 基本重定向 + +```javascript +uni.redirectTo({ + url: '/pages/detail/detail', + success: () => { + console.log('跳转成功') + }, + fail: (err) => { + console.error('跳转失败', err) + } +}) +``` + +### 示例 2: 带参数重定向 + +```javascript +uni.redirectTo({ + url: '/pages/detail/detail?id=123&name=test' +}) + +// 在目标页面接收参数 +// pages/detail/detail.vue +export default { + onLoad(options) { + console.log('接收到的参数', options) + // { id: '123', name: 'test' } + } +} +``` + +### 示例 3: 登录后重定向 + +```javascript +function login() { + // 登录逻辑 + uni.request({ + url: 'https://api.example.com/login', + method: 'POST', + data: { username: 'test', password: '123456' }, + success: (res) => { + if (res.data.success) { + // 保存 token + uni.setStorageSync('token', res.data.token) + // 重定向到首页(关闭登录页) + uni.redirectTo({ + url: '/pages/index/index' + }) + } + } + }) +} +``` + +### 示例 4: 在页面中使用 + +```vue + + + +``` + +### 示例 5: 与 navigateTo 的区别 + +```javascript +// navigateTo: 保留当前页面,可以返回 +uni.navigateTo({ + url: '/pages/detail/detail' +}) +// 页面栈: [首页, 详情页] + +// redirectTo: 关闭当前页面,不能返回 +uni.redirectTo({ + url: '/pages/detail/detail' +}) +// 页面栈: [详情页] (首页被关闭) +``` + +## 参数说明 + +| 参数名 | 类型 | 必填 | 说明 | +|--------|------|------|------| +| url | String | 是 | 需要跳转的应用内非 tabBar 的页面的路径 | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. 不能跳转到 tabBar 页面,需要使用 `uni.switchTab` +2. 会关闭当前页面,无法返回 +3. 路径前需要加 `/`,表示从根目录开始 +4. 适合登录后跳转等不需要返回的场景 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/router.html#redirectto +- **保留页面跳转**: https://doc.dcloud.net.cn/uni-app-x/api/router.html#navigateto +- **重新启动**: https://doc.dcloud.net.cn/uni-app-x/api/router.html#relaunch diff --git a/.agents/bak-skills/uniappx-project/examples/api/navigation/switch-tab.md b/.agents/bak-skills/uniappx-project/examples/api/navigation/switch-tab.md new file mode 100644 index 0000000..c16e352 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/navigation/switch-tab.md @@ -0,0 +1,149 @@ +# uni.switchTab - 切换 TabBar 页面示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/router.html#switchtab + +## 概述 + +`uni.switchTab` 用于跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面。 + +## 基础用法 + +```javascript +uni.switchTab({ + url: '/pages/index/index' +}) +``` + +## 完整示例 + +### 示例 1: 基本切换 + +```javascript +uni.switchTab({ + url: '/pages/index/index', + success: () => { + console.log('切换成功') + }, + fail: (err) => { + console.error('切换失败', err) + } +}) +``` + +### 示例 2: 在页面中使用 + +```vue + + + +``` + +### 示例 3: 登录后跳转到首页 + +```javascript +function login() { + uni.request({ + url: 'https://api.example.com/login', + method: 'POST', + data: { username: 'test', password: '123456' }, + success: (res) => { + if (res.data.success) { + uni.setStorageSync('token', res.data.token) + // 跳转到 tabBar 首页 + uni.switchTab({ + url: '/pages/index/index' + }) + } + } + }) +} +``` + +### 示例 4: 封装切换函数 + +```javascript +// utils/navigation.js +const navigation = { + switchToTab(url) { + uni.switchTab({ + url: url, + fail: (err) => { + console.error('切换失败', err) + // 如果不是 tabBar 页面,使用 navigateTo + uni.navigateTo({ + url: url + }) + } + }) + } +} + +// 使用 +navigation.switchToTab('/pages/index/index') +``` + +## 参数说明 + +| 参数名 | 类型 | 必填 | 说明 | +|--------|------|------|------| +| url | String | 是 | 需要跳转的 tabBar 页面的路径 | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. 只能跳转到 `pages.json` 中配置的 tabBar 页面 +2. 不能传递参数(URL 参数会被忽略) +3. 会关闭所有非 tabBar 页面 +4. 如果目标页面不是 tabBar 页面,会触发 fail 回调 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/router.html#switchtab +- **页面跳转**: https://doc.dcloud.net.cn/uni-app-x/api/router.html#navigateto diff --git a/.agents/bak-skills/uniappx-project/examples/api/network/download-file.md b/.agents/bak-skills/uniappx-project/examples/api/network/download-file.md new file mode 100644 index 0000000..03bd5e4 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/network/download-file.md @@ -0,0 +1,234 @@ +# uni.downloadFile - 下载文件示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/request/network-file.html#downloadfile + +## 概述 + +`uni.downloadFile` 用于下载文件资源到本地。 + +## 基础用法 + +```javascript +uni.downloadFile({ + url: 'https://example.com/file.pdf', + success: (res) => { + console.log('下载成功', res.tempFilePath) + } +}) +``` + +## 完整示例 + +### 示例 1: 下载图片 + +```javascript +uni.downloadFile({ + url: 'https://example.com/image.jpg', + success: (res) => { + if (res.statusCode === 200) { + console.log('下载成功', res.tempFilePath) + // 可以预览或保存图片 + uni.previewImage({ + urls: [res.tempFilePath] + }) + } + }, + fail: (err) => { + console.error('下载失败', err) + } +}) +``` + +### 示例 2: 下载并保存到相册 + +```javascript +uni.downloadFile({ + url: 'https://example.com/image.jpg', + success: (res) => { + if (res.statusCode === 200) { + // 保存到相册 + uni.saveImageToPhotosAlbum({ + filePath: res.tempFilePath, + success: () => { + uni.showToast({ + title: '保存成功', + icon: 'success' + }) + }, + fail: (err) => { + console.error('保存失败', err) + } + }) + } + } +}) +``` + +### 示例 3: 显示下载进度 + +```javascript +uni.downloadFile({ + url: 'https://example.com/large-file.pdf', + success: (res) => { + console.log('下载完成', res.tempFilePath) + }, + fail: (err) => { + console.error('下载失败', err) + } +}) +``` + +### 示例 4: 在页面中使用 + +```vue + + + +``` + +### 示例 5: 封装下载函数 + +```javascript +// utils/download.js +const download = { + downloadFile(url, options = {}) { + return new Promise((resolve, reject) => { + uni.downloadFile({ + url: url, + header: options.header || {}, + success: (res) => { + if (res.statusCode === 200) { + resolve(res.tempFilePath) + } else { + reject(new Error(`下载失败,状态码:${res.statusCode}`)) + } + }, + fail: (err) => { + reject(err) + } + }) + }) + }, + + async downloadAndSave(url) { + try { + const filePath = await this.downloadFile(url) + // 根据文件类型保存 + if (filePath.endsWith('.jpg') || filePath.endsWith('.png')) { + await uni.saveImageToPhotosAlbum({ filePath }) + } else { + await uni.saveFile({ tempFilePath: filePath }) + } + return filePath + } catch (err) { + throw err + } + } +} + +// 使用 +download.downloadFile('https://example.com/file.pdf') + .then(filePath => { + console.log('下载成功', filePath) + }) + .catch(err => { + console.error('下载失败', err) + }) +``` + +## 参数说明 + +| 参数名 | 类型 | 必填 | 说明 | +|--------|------|------|------| +| url | String | 是 | 下载资源的 url | +| header | Object | 否 | HTTP 请求 Header | + +## 返回值 + +| 参数名 | 类型 | 说明 | +|--------|------|------| +| tempFilePath | String | 临时文件路径,下载后的文件会存储到一个临时文件 | +| statusCode | Number | HTTP 状态码 | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. 下载的文件是临时文件,需要保存才能永久使用 +2. 可以通过 `statusCode` 判断下载是否成功 +3. 下载的文件路径是临时路径,应用关闭后可能失效 +4. 建议下载后立即保存或使用 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/request/network-file.html#downloadfile +- **保存文件**: https://doc.dcloud.net.cn/uni-app-x/api/file/file.html#savefile +- **打开文档**: https://doc.dcloud.net.cn/uni-app-x/api/file/file.html#opendocument diff --git a/.agents/bak-skills/uniappx-project/examples/api/network/request.md b/.agents/bak-skills/uniappx-project/examples/api/network/request.md new file mode 100644 index 0000000..6ade91d --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/network/request.md @@ -0,0 +1,287 @@ +# uni.request - 网络请求示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/request/request.html + +## 概述 + +`uni.request` 用于发起网络请求,支持 GET、POST、PUT、DELETE 等方法。 + +## 基础用法 + +### GET 请求 + +```javascript +uni.request({ + url: 'https://api.example.com/data', + method: 'GET', + success: (res) => { + console.log('请求成功', res.data) + }, + fail: (err) => { + console.error('请求失败', err) + } +}) +``` + +### POST 请求 + +```javascript +uni.request({ + url: 'https://api.example.com/user', + method: 'POST', + data: { + name: 'John', + age: 30 + }, + header: { + 'Content-Type': 'application/json' + }, + success: (res) => { + console.log('请求成功', res.data) + } +}) +``` + +## 完整示例 + +### 示例 1: 带参数的 GET 请求 + +```javascript +uni.request({ + url: 'https://api.example.com/users', + method: 'GET', + data: { + page: 1, + limit: 10 + }, + success: (res) => { + if (res.statusCode === 200) { + console.log('用户列表', res.data) + } + }, + fail: (err) => { + uni.showToast({ + title: '请求失败', + icon: 'none' + }) + } +}) +``` + +### 示例 2: POST 请求上传数据 + +```javascript +uni.request({ + url: 'https://api.example.com/users', + method: 'POST', + data: { + name: 'John Doe', + email: 'john@example.com', + age: 30 + }, + header: { + 'Content-Type': 'application/json', + 'Authorization': 'Bearer token123' + }, + success: (res) => { + if (res.statusCode === 200 || res.statusCode === 201) { + uni.showToast({ + title: '创建成功', + icon: 'success' + }) + } + } +}) +``` + +### 示例 3: 使用 Promise + +```javascript +// Promise 方式(部分平台支持) +uni.request({ + url: 'https://api.example.com/data' +}).then(res => { + console.log('请求成功', res.data) +}).catch(err => { + console.error('请求失败', err) +}) +``` + +### 示例 4: 封装请求函数 + +```javascript +// utils/request.js +const request = (options) => { + return new Promise((resolve, reject) => { + uni.request({ + url: options.url, + method: options.method || 'GET', + data: options.data || {}, + header: { + 'Content-Type': 'application/json', + ...options.header + }, + success: (res) => { + if (res.statusCode === 200) { + resolve(res.data) + } else { + reject(new Error(`请求失败: ${res.statusCode}`)) + } + }, + fail: (err) => { + reject(err) + } + }) + }) +} + +// 使用 +request({ + url: 'https://api.example.com/data', + method: 'GET' +}).then(data => { + console.log('数据', data) +}).catch(err => { + console.error('错误', err) +}) +``` + +### 示例 5: 请求拦截和响应拦截 + +```javascript +// utils/http.js +const baseURL = 'https://api.example.com' + +// 请求拦截 +const requestInterceptor = (config) => { + // 添加 token + const token = uni.getStorageSync('token') + if (token) { + config.header = { + ...config.header, + 'Authorization': `Bearer ${token}` + } + } + return config +} + +// 响应拦截 +const responseInterceptor = (res) => { + if (res.statusCode === 401) { + // token 过期,跳转登录 + uni.navigateTo({ + url: '/pages/login/login' + }) + return Promise.reject(new Error('未授权')) + } + return res.data +} + +const http = { + request(options) { + const config = requestInterceptor({ + url: baseURL + options.url, + method: options.method || 'GET', + data: options.data || {}, + header: options.header || {} + }) + + return new Promise((resolve, reject) => { + uni.request({ + ...config, + success: (res) => { + try { + const data = responseInterceptor(res) + resolve(data) + } catch (err) { + reject(err) + } + }, + fail: (err) => { + reject(err) + } + }) + }) + } +} + +export default http +``` + +### 示例 6: 超时处理 + +```javascript +uni.request({ + url: 'https://api.example.com/data', + method: 'GET', + timeout: 5000, // 5秒超时 + success: (res) => { + console.log('请求成功', res.data) + }, + fail: (err) => { + if (err.errMsg && err.errMsg.includes('timeout')) { + uni.showToast({ + title: '请求超时', + icon: 'none' + }) + } else { + uni.showToast({ + title: '请求失败', + icon: 'none' + }) + } + } +}) +``` + +### 示例 7: 处理不同数据类型 + +```javascript +// JSON 数据 +uni.request({ + url: 'https://api.example.com/data', + dataType: 'json', + success: (res) => { + console.log('JSON 数据', res.data) + } +}) + +// 文本数据 +uni.request({ + url: 'https://api.example.com/text', + dataType: 'text', + success: (res) => { + console.log('文本数据', res.data) + } +}) + +// ArrayBuffer 数据 +uni.request({ + url: 'https://api.example.com/binary', + responseType: 'arraybuffer', + success: (res) => { + console.log('二进制数据', res.data) + } +}) +``` + +## 平台差异 + +- **H5**: 支持 `withCredentials` 参数,用于跨域请求携带凭证 +- **App**: 支持 `sslVerify` 参数,用于验证 SSL 证书 +- **App**: 支持 `firstIpv4` 参数,DNS 解析时优先使用 IPv4 + +## 注意事项 + +1. 默认超时时间为 60000ms(60秒) +2. 默认 `dataType` 为 `json`,会自动解析 JSON 数据 +3. 请求 header 中不能设置 `Referer` +4. 部分平台支持 Promise 方式调用 +5. 建议封装统一的请求函数,便于统一处理错误和拦截 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/request/request.html +- **网络请求最佳实践**: https://doc.dcloud.net.cn/uni-app-x/api/request/request.html diff --git a/.agents/bak-skills/uniappx-project/examples/api/network/upload-file.md b/.agents/bak-skills/uniappx-project/examples/api/network/upload-file.md new file mode 100644 index 0000000..125cac2 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/network/upload-file.md @@ -0,0 +1,262 @@ +# uni.uploadFile - 上传文件示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/request/network-file.html#uploadfile + +## 概述 + +`uni.uploadFile` 用于将本地资源上传到服务器。 + +## 基础用法 + +```javascript +uni.uploadFile({ + url: 'https://api.example.com/upload', + filePath: '/tmp/image.jpg', + name: 'file', + success: (res) => { + console.log('上传成功', res.data) + } +}) +``` + +## 完整示例 + +### 示例 1: 上传图片 + +```javascript +// 先选择图片 +uni.chooseImage({ + count: 1, + success: (res) => { + const tempFilePath = res.tempFilePaths[0] + + // 上传图片 + uni.uploadFile({ + url: 'https://api.example.com/upload', + filePath: tempFilePath, + name: 'file', + formData: { + 'user': 'test' + }, + success: (uploadRes) => { + const data = JSON.parse(uploadRes.data) + console.log('上传成功', data.url) + uni.showToast({ + title: '上传成功', + icon: 'success' + }) + }, + fail: (err) => { + console.error('上传失败', err) + uni.showToast({ + title: '上传失败', + icon: 'none' + }) + } + }) + } +}) +``` + +### 示例 2: 上传多张图片 + +```javascript +uni.chooseImage({ + count: 9, + success: (res) => { + const tempFilePaths = res.tempFilePaths + let uploadCount = 0 + + tempFilePaths.forEach((filePath, index) => { + uni.uploadFile({ + url: 'https://api.example.com/upload', + filePath: filePath, + name: 'file', + success: () => { + uploadCount++ + if (uploadCount === tempFilePaths.length) { + uni.showToast({ + title: '全部上传成功', + icon: 'success' + }) + } + }, + fail: (err) => { + console.error(`第${index + 1}张图片上传失败`, err) + } + }) + }) + } +}) +``` + +### 示例 3: 显示上传进度 + +```javascript +uni.chooseImage({ + count: 1, + success: (res) => { + const tempFilePath = res.tempFilePaths[0] + + uni.uploadFile({ + url: 'https://api.example.com/upload', + filePath: tempFilePath, + name: 'file', + success: (res) => { + console.log('上传成功', res) + }, + fail: (err) => { + console.error('上传失败', err) + } + }) + } +}) +``` + +### 示例 4: 在页面中使用 + +```vue + + + +``` + +### 示例 5: 封装上传函数 + +```javascript +// utils/upload.js +const upload = { + uploadImage(filePath, options = {}) { + return new Promise((resolve, reject) => { + uni.uploadFile({ + url: options.url || 'https://api.example.com/upload', + filePath: filePath, + name: options.name || 'file', + formData: options.formData || {}, + header: options.header || {}, + success: (res) => { + try { + const data = JSON.parse(res.data) + resolve(data) + } catch (e) { + resolve(res.data) + } + }, + fail: (err) => { + reject(err) + } + }) + }) + } +} + +// 使用 +const filePath = '/tmp/image.jpg' +upload.uploadImage(filePath, { + url: 'https://api.example.com/upload', + formData: { userId: '123' } +}).then(data => { + console.log('上传成功', data) +}).catch(err => { + console.error('上传失败', err) +}) +``` + +## 参数说明 + +| 参数名 | 类型 | 必填 | 说明 | +|--------|------|------|------| +| url | String | 是 | 开发者服务器地址 | +| filePath | String | 是 | 要上传文件资源的路径 | +| name | String | 是 | 文件对应的 key,开发者在服务端可以通过这个 key 获取文件的二进制内容 | +| header | Object | 否 | HTTP 请求 Header | +| formData | Object | 否 | HTTP 请求中其他额外的 form data | + +## 返回值 + +| 参数名 | 类型 | 说明 | +|--------|------|------| +| data | String | 服务器返回的数据 | +| statusCode | Number | HTTP 状态码 | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. 上传文件前需要先选择文件(使用 `uni.chooseImage` 等) +2. `filePath` 必须是本地路径 +3. 可以通过 `formData` 传递额外的表单数据 +4. 建议在请求头中添加认证信息 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/request/network-file.html#uploadfile +- **选择图片**: https://doc.dcloud.net.cn/uni-app-x/api/media/image.html#chooseimage +- **下载文件**: https://doc.dcloud.net.cn/uni-app-x/api/request/network-file.html#downloadfile diff --git a/.agents/bak-skills/uniappx-project/examples/api/storage/clear-storage.md b/.agents/bak-skills/uniappx-project/examples/api/storage/clear-storage.md new file mode 100644 index 0000000..88257b7 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/storage/clear-storage.md @@ -0,0 +1,137 @@ +# uni.clearStorage - 清除所有存储数据示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/storage/storage.html#clearstorage + +## 概述 + +`uni.clearStorage` 用于清理本地数据缓存,清除所有存储的数据。 + +## 基础用法 + +```javascript +uni.clearStorage({ + success: () => { + console.log('清除成功') + } +}) +``` + +## 完整示例 + +### 示例 1: 清除所有数据 + +```javascript +uni.clearStorage({ + success: () => { + console.log('所有数据已清除') + uni.showToast({ + title: '清除成功', + icon: 'success' + }) + }, + fail: (err) => { + console.error('清除失败', err) + } +}) +``` + +### 示例 2: 退出登录时清除 + +```javascript +function logout() { + uni.clearStorage({ + success: () => { + console.log('数据已清除') + // 跳转到登录页 + uni.reLaunch({ + url: '/pages/login/login' + }) + } + }) +} +``` + +### 示例 3: 在页面中使用 + +```vue + + + +``` + +### 示例 4: 同步版本 + +```javascript +try { + uni.clearStorageSync() + console.log('清除成功') +} catch (err) { + console.error('清除失败', err) +} +``` + +## 参数说明 + +此 API 无需参数。 + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. 此操作会清除所有本地存储的数据,请谨慎使用 +2. 建议在清除前提示用户确认 +3. 同步版本 `clearStorageSync` 性能更好 +4. 清除后可能需要重新登录或初始化数据 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/storage/storage.html#clearstorage +- **同步版本**: https://doc.dcloud.net.cn/uni-app-x/api/storage/storage.html#clearstoragesync +- **删除单个**: https://doc.dcloud.net.cn/uni-app-x/api/storage/storage.html#removestorage diff --git a/.agents/bak-skills/uniappx-project/examples/api/storage/get-storage-info.md b/.agents/bak-skills/uniappx-project/examples/api/storage/get-storage-info.md new file mode 100644 index 0000000..0741721 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/storage/get-storage-info.md @@ -0,0 +1,202 @@ +# uni.getStorageInfo - 获取存储信息示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/storage/storage.html#getstorageinfo + +## 概述 + +`uni.getStorageInfo` 用于异步获取当前 storage 的相关信息。 + +## 基础用法 + +```javascript +uni.getStorageInfo({ + success: (res) => { + console.log('存储信息', res) + } +}) +``` + +## 完整示例 + +### 示例 1: 获取存储信息 + +```javascript +uni.getStorageInfo({ + success: (res) => { + console.log('所有key', res.keys) + console.log('当前占用的空间大小', res.currentSize, 'KB') + console.log('限制的空间大小', res.limitSize, 'KB') + }, + fail: (err) => { + console.error('获取失败', err) + } +}) +``` + +### 示例 2: 检查存储空间 + +```javascript +function checkStorageSpace() { + uni.getStorageInfo({ + success: (res) => { + const usagePercent = (res.currentSize / res.limitSize * 100).toFixed(2) + console.log(`存储使用率:${usagePercent}%`) + + if (usagePercent > 80) { + uni.showModal({ + title: '提示', + content: '存储空间不足,建议清理缓存', + showCancel: false + }) + } + } + }) +} +``` + +### 示例 3: 在页面中使用 + +```vue + + + + + +``` + +### 示例 4: 清理存储空间 + +```javascript +function clearStorageIfNeeded() { + uni.getStorageInfo({ + success: (res) => { + const usagePercent = (res.currentSize / res.limitSize) * 100 + + if (usagePercent > 80) { + uni.showModal({ + title: '提示', + content: '存储空间不足,是否清理缓存?', + success: (modalRes) => { + if (modalRes.confirm) { + // 清理非关键数据 + const importantKeys = ['token', 'userInfo'] + res.keys.forEach(key => { + if (!importantKeys.includes(key)) { + uni.removeStorageSync(key) + } + }) + uni.showToast({ + title: '清理完成', + icon: 'success' + }) + } + } + }) + } + } + }) +} +``` + +### 示例 5: 同步版本 + +```javascript +try { + const storageInfo = uni.getStorageInfoSync() + console.log('所有key', storageInfo.keys) + console.log('当前大小', storageInfo.currentSize, 'KB') + console.log('限制大小', storageInfo.limitSize, 'KB') +} catch (err) { + console.error('获取失败', err) +} +``` + +## 返回值 + +| 参数名 | 类型 | 说明 | +|--------|------|------| +| keys | Array | 当前 storage 中所有的 key | +| currentSize | Number | 当前占用的空间大小,单位 KB | +| limitSize | Number | 限制的空间大小,单位 KB | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. 可以通过 `keys` 获取所有存储的 key +2. `currentSize` 和 `limitSize` 单位都是 KB +3. 建议定期检查存储空间使用情况 +4. 同步版本 `getStorageInfoSync` 性能更好 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/storage/storage.html#getstorageinfo +- **同步版本**: https://doc.dcloud.net.cn/uni-app-x/api/storage/storage.html#getstorageinfosync +- **清除存储**: https://doc.dcloud.net.cn/uni-app-x/api/storage/storage.html#clearstorage diff --git a/.agents/bak-skills/uniappx-project/examples/api/storage/get-storage-sync.md b/.agents/bak-skills/uniappx-project/examples/api/storage/get-storage-sync.md new file mode 100644 index 0000000..e903956 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/storage/get-storage-sync.md @@ -0,0 +1,200 @@ +# uni.getStorageSync - 同步获取存储数据示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/storage/storage.html#getstoragesync + +## 概述 + +`uni.getStorageSync` 用于从本地缓存中同步获取指定 key 的内容。 + +## 基础用法 + +```javascript +try { + const value = uni.getStorageSync('key') + console.log('获取的数据', value) +} catch (err) { + console.error('获取失败', err) +} +``` + +## 完整示例 + +### 示例 1: 获取用户信息 + +```javascript +try { + const userInfo = uni.getStorageSync('userInfo') + if (userInfo) { + console.log('用户信息', userInfo) + } else { + console.log('数据不存在') + } +} catch (err) { + console.error('获取失败', err) +} +``` + +### 示例 2: 获取 Token + +```javascript +function getToken() { + try { + const token = uni.getStorageSync('token') + return token || null + } catch (err) { + console.error('获取Token失败', err) + return null + } +} + +// 使用 +const token = getToken() +if (token) { + console.log('Token存在', token) +} else { + console.log('未登录') +} +``` + +### 示例 3: 在页面中使用 + +```vue + + + +``` + +### 示例 4: 封装获取函数 + +```javascript +// utils/storage.js +const storage = { + get(key, defaultValue = null) { + try { + const value = uni.getStorageSync(key) + return value !== '' ? value : defaultValue + } catch (err) { + console.error(`获取${key}失败`, err) + return defaultValue + } + }, + + getString(key, defaultValue = '') { + return this.get(key, defaultValue) + }, + + getNumber(key, defaultValue = 0) { + const value = this.get(key, defaultValue) + return Number(value) || defaultValue + }, + + getBoolean(key, defaultValue = false) { + const value = this.get(key, defaultValue) + return Boolean(value) + }, + + getObject(key, defaultValue = {}) { + const value = this.get(key, defaultValue) + return typeof value === 'object' ? value : defaultValue + } +} + +// 使用 +const userInfo = storage.getObject('userInfo', {}) +const token = storage.getString('token', '') +const count = storage.getNumber('count', 0) +``` + +### 示例 5: 检查数据是否存在 + +```javascript +function hasStorage(key) { + try { + const value = uni.getStorageSync(key) + return value !== '' && value !== null && value !== undefined + } catch (err) { + return false + } +} + +// 使用 +if (hasStorage('userInfo')) { + console.log('用户信息存在') +} else { + console.log('用户信息不存在') +} +``` + +## 参数说明 + +| 参数名 | 类型 | 必填 | 说明 | +|--------|------|------|------| +| key | String | 是 | 本地缓存中指定的 key | + +## 返回值 + +| 类型 | 说明 | +|------|------| +| Any | key 对应的内容 | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. 同步接口会阻塞后续代码执行,性能比异步接口好 +2. 如果 key 不存在,返回空字符串 +3. 建议使用 try-catch 处理错误 +4. 适合在页面初始化时获取数据 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/storage/storage.html#getstoragesync +- **异步版本**: https://doc.dcloud.net.cn/uni-app-x/api/storage/storage.html#getstorage +- **设置存储**: https://doc.dcloud.net.cn/uni-app-x/api/storage/storage.html#setstoragesync diff --git a/.agents/bak-skills/uniappx-project/examples/api/storage/get-storage.md b/.agents/bak-skills/uniappx-project/examples/api/storage/get-storage.md new file mode 100644 index 0000000..ae79408 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/storage/get-storage.md @@ -0,0 +1,175 @@ +# uni.getStorage - 获取存储数据示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/storage/storage.html#getstorage + +## 概述 + +`uni.getStorage` 用于从本地缓存中异步获取指定 key 的内容。 + +## 基础用法 + +```javascript +uni.getStorage({ + key: 'userInfo', + success: (res) => { + console.log('获取的数据', res.data) + } +}) +``` + +## 完整示例 + +### 示例 1: 获取用户信息 + +```javascript +uni.getStorage({ + key: 'userInfo', + success: (res) => { + const userInfo = res.data + console.log('用户信息', userInfo) + // 使用用户信息 + }, + fail: (err) => { + console.error('获取失败', err) + // 数据不存在或获取失败 + } +}) +``` + +### 示例 2: 获取字符串 + +```javascript +uni.getStorage({ + key: 'token', + success: (res) => { + const token = res.data + console.log('Token', token) + // 使用 token + } +}) +``` + +### 示例 3: 获取数组 + +```javascript +uni.getStorage({ + key: 'shoppingCart', + success: (res) => { + const cart = res.data || [] + console.log('购物车', cart) + } +}) +``` + +### 示例 4: 封装获取函数 + +```javascript +// utils/storage.js +const storage = { + get(key) { + return new Promise((resolve, reject) => { + uni.getStorage({ + key: key, + success: (res) => { + resolve(res.data) + }, + fail: (err) => { + if (err.errMsg.includes('data not found')) { + resolve(null) // 数据不存在返回 null + } else { + reject(err) + } + } + }) + }) + } +} + +// 使用 +storage.get('userInfo') + .then(data => { + if (data) { + console.log('用户信息', data) + } else { + console.log('数据不存在') + } + }) + .catch(err => { + console.error('获取失败', err) + }) +``` + +### 示例 5: 在页面中使用 + +```vue + + + +``` + +## 同步版本 + +使用 `uni.getStorageSync` 进行同步获取: + +```javascript +try { + const userInfo = uni.getStorageSync('userInfo') + if (userInfo) { + console.log('用户信息', userInfo) + } else { + console.log('数据不存在') + } +} catch (err) { + console.error('获取失败', err) +} +``` + +## 注意事项 + +1. 如果 key 不存在,会触发 fail 回调 +2. 建议使用 try-catch 处理同步接口的错误 +3. 获取的数据类型与存储时一致 +4. 异步接口不会阻塞后续代码执行 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/storage/storage.html#getstorage +- **同步版本**: https://doc.dcloud.net.cn/uni-app-x/api/storage/storage.html#getstoragesync +- **设置存储**: https://doc.dcloud.net.cn/uni-app-x/api/storage/storage.html#setstorage diff --git a/.agents/bak-skills/uniappx-project/examples/api/storage/remove-storage.md b/.agents/bak-skills/uniappx-project/examples/api/storage/remove-storage.md new file mode 100644 index 0000000..ad20439 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/storage/remove-storage.md @@ -0,0 +1,160 @@ +# uni.removeStorage - 删除存储数据示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/storage/storage.html#removestorage + +## 概述 + +`uni.removeStorage` 用于从本地缓存中异步移除指定 key。 + +## 基础用法 + +```javascript +uni.removeStorage({ + key: 'userInfo', + success: () => { + console.log('删除成功') + } +}) +``` + +## 完整示例 + +### 示例 1: 删除单个数据 + +```javascript +uni.removeStorage({ + key: 'token', + success: () => { + console.log('Token 已删除') + }, + fail: (err) => { + console.error('删除失败', err) + } +}) +``` + +### 示例 2: 退出登录时清除数据 + +```javascript +function logout() { + // 删除用户信息 + uni.removeStorage({ + key: 'userInfo', + success: () => { + console.log('用户信息已清除') + } + }) + + // 删除 Token + uni.removeStorage({ + key: 'token', + success: () => { + console.log('Token 已清除') + // 跳转到登录页 + uni.reLaunch({ + url: '/pages/login/login' + }) + } + }) +} +``` + +### 示例 3: 批量删除 + +```javascript +const keysToRemove = ['userInfo', 'token', 'settings'] + +keysToRemove.forEach(key => { + uni.removeStorage({ + key: key, + success: () => { + console.log(`${key} 已删除`) + } + }) +}) +``` + +### 示例 4: 在页面中使用 + +```vue + + + +``` + +### 示例 5: 同步版本 + +```javascript +try { + uni.removeStorageSync('userInfo') + console.log('删除成功') +} catch (err) { + console.error('删除失败', err) +} +``` + +## 参数说明 + +| 参数名 | 类型 | 必填 | 说明 | +|--------|------|------|------| +| key | String | 是 | 本地缓存中指定的 key | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. 如果 key 不存在,不会报错 +2. 建议使用同步版本 `removeStorageSync` 性能更好 +3. 删除操作是异步的,需要等待 success 回调 +4. 退出登录时建议清除所有相关数据 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/storage/storage.html#removestorage +- **同步版本**: https://doc.dcloud.net.cn/uni-app-x/api/storage/storage.html#removestoragesync +- **清除所有**: https://doc.dcloud.net.cn/uni-app-x/api/storage/storage.html#clearstorage diff --git a/.agents/bak-skills/uniappx-project/examples/api/storage/set-storage-sync.md b/.agents/bak-skills/uniappx-project/examples/api/storage/set-storage-sync.md new file mode 100644 index 0000000..5e48d8b --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/storage/set-storage-sync.md @@ -0,0 +1,196 @@ +# uni.setStorageSync - 同步设置存储数据示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/storage/storage.html#setstoragesync + +## 概述 + +`uni.setStorageSync` 用于同步将数据存储在本地缓存中指定的 key 中。 + +## 基础用法 + +```javascript +try { + uni.setStorageSync('key', 'value') + console.log('存储成功') +} catch (err) { + console.error('存储失败', err) +} +``` + +## 完整示例 + +### 示例 1: 存储用户信息 + +```javascript +try { + const userInfo = { + name: 'John', + age: 30, + email: 'john@example.com' + } + uni.setStorageSync('userInfo', userInfo) + console.log('存储成功') +} catch (err) { + console.error('存储失败', err) +} +``` + +### 示例 2: 存储 Token + +```javascript +function saveToken(token) { + try { + uni.setStorageSync('token', token) + return true + } catch (err) { + console.error('存储Token失败', err) + return false + } +} + +// 使用 +if (saveToken('abc123')) { + console.log('Token已保存') +} +``` + +### 示例 3: 在页面中使用 + +```vue + + + +``` + +### 示例 4: 封装存储函数 + +```javascript +// utils/storage.js +const storage = { + set(key, value) { + try { + uni.setStorageSync(key, value) + return true + } catch (err) { + console.error(`存储${key}失败`, err) + return false + } + }, + + setString(key, value) { + return this.set(key, String(value)) + }, + + setNumber(key, value) { + return this.set(key, Number(value)) + }, + + setBoolean(key, value) { + return this.set(key, Boolean(value)) + }, + + setObject(key, value) { + return this.set(key, value) + } +} + +// 使用 +storage.setString('token', 'abc123') +storage.setNumber('count', 10) +storage.setBoolean('isLogin', true) +storage.setObject('userInfo', { name: 'John' }) +``` + +### 示例 5: 批量存储 + +```javascript +function saveMultipleData(data) { + try { + Object.keys(data).forEach(key => { + uni.setStorageSync(key, data[key]) + }) + return true + } catch (err) { + console.error('批量存储失败', err) + return false + } +} + +// 使用 +saveMultipleData({ + token: 'abc123', + userInfo: { name: 'John' }, + settings: { theme: 'dark' } +}) +``` + +## 参数说明 + +| 参数名 | 类型 | 必填 | 说明 | +|--------|------|------|------| +| key | String | 是 | 本地缓存中指定的 key | +| data | Any | 是 | 需要存储的内容 | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. 同步接口会阻塞后续代码执行,性能比异步接口好 +2. 存储的数据类型与设置时一致 +3. 建议使用 try-catch 处理错误 +4. 单个 key 允许存储的最大数据长度为 1MB + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/storage/storage.html#setstoragesync +- **异步版本**: https://doc.dcloud.net.cn/uni-app-x/api/storage/storage.html#setstorage +- **获取存储**: https://doc.dcloud.net.cn/uni-app-x/api/storage/storage.html#getstoragesync diff --git a/.agents/bak-skills/uniappx-project/examples/api/storage/set-storage.md b/.agents/bak-skills/uniappx-project/examples/api/storage/set-storage.md new file mode 100644 index 0000000..b50b760 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/storage/set-storage.md @@ -0,0 +1,160 @@ +# uni.setStorage - 数据存储示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/storage/storage.html#setstorage + +## 概述 + +`uni.setStorage` 用于将数据存储在本地缓存中指定的 key 中,异步接口。 + +## 基础用法 + +```javascript +uni.setStorage({ + key: 'userInfo', + data: { + name: 'John', + age: 30 + }, + success: () => { + console.log('存储成功') + }, + fail: (err) => { + console.error('存储失败', err) + } +}) +``` + +## 完整示例 + +### 示例 1: 存储用户信息 + +```javascript +// 存储用户信息 +const userInfo = { + id: 1, + name: 'John Doe', + email: 'john@example.com', + avatar: 'https://example.com/avatar.jpg' +} + +uni.setStorage({ + key: 'userInfo', + data: userInfo, + success: () => { + uni.showToast({ + title: '保存成功', + icon: 'success' + }) + }, + fail: (err) => { + uni.showToast({ + title: '保存失败', + icon: 'none' + }) + } +}) +``` + +### 示例 2: 存储字符串 + +```javascript +uni.setStorage({ + key: 'token', + data: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...', + success: () => { + console.log('Token 已保存') + } +}) +``` + +### 示例 3: 存储数组 + +```javascript +const shoppingCart = [ + { id: 1, name: '商品1', price: 99 }, + { id: 2, name: '商品2', price: 199 } +] + +uni.setStorage({ + key: 'shoppingCart', + data: shoppingCart, + success: () => { + console.log('购物车已保存') + } +}) +``` + +### 示例 4: 封装存储函数 + +```javascript +// utils/storage.js +const storage = { + set(key, data) { + return new Promise((resolve, reject) => { + uni.setStorage({ + key: key, + data: data, + success: () => { + resolve() + }, + fail: (err) => { + reject(err) + } + }) + }) + }, + + get(key) { + return new Promise((resolve, reject) => { + uni.getStorage({ + key: key, + success: (res) => { + resolve(res.data) + }, + fail: (err) => { + reject(err) + } + }) + }) + } +} + +// 使用 +storage.set('userInfo', { name: 'John' }) + .then(() => { + console.log('存储成功') + }) + .catch(err => { + console.error('存储失败', err) + }) +``` + +## 同步版本 + +使用 `uni.setStorageSync` 进行同步存储: + +```javascript +try { + uni.setStorageSync('userInfo', { + name: 'John', + age: 30 + }) + console.log('存储成功') +} catch (err) { + console.error('存储失败', err) +} +``` + +## 注意事项 + +1. 存储的数据会被持久化,除非手动删除或清除缓存 +2. 单个 key 允许存储的最大数据长度为 1MB +3. 异步接口不会阻塞后续代码执行 +4. 建议使用 try-catch 处理同步接口的错误 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/storage/storage.html#setstorage +- **同步版本**: https://doc.dcloud.net.cn/uni-app-x/api/storage/storage.html#setstoragesync diff --git a/.agents/bak-skills/uniappx-project/examples/api/ui/hide-loading.md b/.agents/bak-skills/uniappx-project/examples/api/ui/hide-loading.md new file mode 100644 index 0000000..73a9547 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/ui/hide-loading.md @@ -0,0 +1,189 @@ +# uni.hideLoading - 隐藏加载提示示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/ui/prompt.html#hideloading + +## 概述 + +`uni.hideLoading` 用于隐藏加载提示框。 + +## 基础用法 + +```javascript +uni.hideLoading() +``` + +## 完整示例 + +### 示例 1: 基本使用 + +```javascript +// 显示加载 +uni.showLoading({ + title: '加载中...' +}) + +// 隐藏加载 +setTimeout(() => { + uni.hideLoading() +}, 2000) +``` + +### 示例 2: 网络请求中使用 + +```javascript +// 显示加载 +uni.showLoading({ + title: '加载中...', + mask: true +}) + +uni.request({ + url: 'https://api.example.com/data', + success: (res) => { + console.log('数据', res.data) + }, + complete: () => { + // 请求完成后隐藏加载 + uni.hideLoading() + } +}) +``` + +### 示例 3: 在页面中使用 + +```vue + + + +``` + +### 示例 4: 封装加载函数 + +```javascript +// utils/loading.js +const loading = { + show(title = '加载中...') { + uni.showLoading({ + title: title, + mask: true + }) + }, + + hide() { + uni.hideLoading() + }, + + async withLoading(fn, title = '加载中...') { + this.show(title) + try { + const result = await fn() + return result + } finally { + this.hide() + } + } +} + +// 使用 +loading.withLoading(async () => { + const data = await fetchData() + return data +}, '加载数据中...') +``` + +### 示例 5: 确保隐藏加载 + +```javascript +function loadData() { + let loadingShown = false + + try { + uni.showLoading({ + title: '加载中...', + mask: true + }) + loadingShown = true + + // 执行加载逻辑 + uni.request({ + url: 'https://api.example.com/data', + success: (res) => { + console.log('数据', res.data) + }, + complete: () => { + if (loadingShown) { + uni.hideLoading() + loadingShown = false + } + } + }) + } catch (err) { + // 确保异常时也隐藏加载 + if (loadingShown) { + uni.hideLoading() + loadingShown = false + } + } +} +``` + +## 参数说明 + +此 API 无需参数。 + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. 必须与 `uni.showLoading` 配对使用 +2. 建议在 `complete` 回调中调用,确保无论成功失败都会隐藏 +3. 多次调用 `showLoading` 后,只需调用一次 `hideLoading` 即可隐藏 +4. 建议使用 try-finally 确保异常时也能隐藏 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/ui/prompt.html#hideloading +- **显示加载**: https://doc.dcloud.net.cn/uni-app-x/api/ui/prompt.html#showloading diff --git a/.agents/bak-skills/uniappx-project/examples/api/ui/hide-navigation-bar-loading.md b/.agents/bak-skills/uniappx-project/examples/api/ui/hide-navigation-bar-loading.md new file mode 100644 index 0000000..4e143fa --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/ui/hide-navigation-bar-loading.md @@ -0,0 +1,140 @@ +# uni.hideNavigationBarLoading - 隐藏导航栏加载动画示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/ui/navigation-bar.html#hidenavigationbarloading + +## 概述 + +`uni.hideNavigationBarLoading` 用于隐藏当前页面导航栏的加载动画。 + +## 基础用法 + +```javascript +uni.hideNavigationBarLoading() +``` + +## 完整示例 + +### 示例 1: 基本使用 + +```javascript +// 显示加载动画 +uni.showNavigationBarLoading() + +// 隐藏加载动画 +uni.hideNavigationBarLoading() +``` + +### 示例 2: 网络请求中使用 + +```javascript +// 显示加载动画 +uni.showNavigationBarLoading() + +uni.request({ + url: 'https://api.example.com/data', + success: (res) => { + console.log('数据', res.data) + }, + complete: () => { + // 请求完成后隐藏 + uni.hideNavigationBarLoading() + } +}) +``` + +### 示例 3: 在页面中使用 + +```vue + + + +``` + +### 示例 4: 确保隐藏 + +```javascript +function loadData() { + let loadingShown = false + + try { + uni.showNavigationBarLoading() + loadingShown = true + + uni.request({ + url: 'https://api.example.com/data', + success: (res) => { + console.log('数据', res.data) + }, + complete: () => { + if (loadingShown) { + uni.hideNavigationBarLoading() + loadingShown = false + } + } + }) + } catch (err) { + // 确保异常时也隐藏 + if (loadingShown) { + uni.hideNavigationBarLoading() + loadingShown = false + } + } +} +``` + +## 参数说明 + +此 API 无需参数。 + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. 必须与 `uni.showNavigationBarLoading` 配对使用 +2. 建议在 `complete` 回调中调用,确保无论成功失败都会隐藏 +3. 多次调用 `showNavigationBarLoading` 后,只需调用一次 `hideNavigationBarLoading` 即可隐藏 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/ui/navigation-bar.html#hidenavigationbarloading +- **显示加载**: https://doc.dcloud.net.cn/uni-app-x/api/ui/navigation-bar.html#shownavigationbarloading diff --git a/.agents/bak-skills/uniappx-project/examples/api/ui/hide-tab-bar-red-dot.md b/.agents/bak-skills/uniappx-project/examples/api/ui/hide-tab-bar-red-dot.md new file mode 100644 index 0000000..5af6795 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/ui/hide-tab-bar-red-dot.md @@ -0,0 +1,147 @@ +# uni.hideTabBarRedDot - 隐藏 TabBar 红点示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/ui/tab-bar.html#hidetabbarreddot + +## 概述 + +`uni.hideTabBarRedDot` 用于隐藏 tabBar 某一项的右上角的红点。 + +## 基础用法 + +```javascript +uni.hideTabBarRedDot({ + index: 0 +}) +``` + +## 完整示例 + +### 示例 1: 隐藏红点 + +```javascript +uni.hideTabBarRedDot({ + index: 0, // tabBar 的哪一项,从左边算起 + success: () => { + console.log('隐藏成功') + }, + fail: (err) => { + console.error('隐藏失败', err) + } +}) +``` + +### 示例 2: 阅读消息后隐藏 + +```javascript +function readMessage(messageId) { + // 标记消息为已读 + uni.request({ + url: `https://api.example.com/messages/${messageId}/read`, + method: 'POST', + success: () => { + // 隐藏消息红点 + uni.hideTabBarRedDot({ + index: 1 // 消息页面的索引 + }) + } + }) +} +``` + +### 示例 3: 在页面中使用 + +```vue + + + +``` + +### 示例 4: 进入页面时隐藏 + +```vue + + + +``` + +### 示例 5: 清除所有红点 + +```javascript +function clearAllRedDots(tabBarCount) { + for (let i = 0; i < tabBarCount; i++) { + uni.hideTabBarRedDot({ + index: i + }) + } +} + +// 使用(假设有4个tabBar) +clearAllRedDots(4) +``` + +## 参数说明 + +| 参数名 | 类型 | 必填 | 说明 | +|--------|------|------|------| +| index | Number | 是 | tabBar 的哪一项,从左边算起 | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. `index` 从 0 开始,对应 `pages.json` 中 tabBar 的配置顺序 +2. 如果该 tabBar 项没有红点,调用此 API 不会报错 +3. 建议在用户查看相关内容后隐藏红点 +4. 与 `showTabBarRedDot` 配合使用 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/ui/tab-bar.html#hidetabbarreddot +- **显示红点**: https://doc.dcloud.net.cn/uni-app-x/api/ui/tab-bar.html#showtabbarreddot diff --git a/.agents/bak-skills/uniappx-project/examples/api/ui/hide-toast.md b/.agents/bak-skills/uniappx-project/examples/api/ui/hide-toast.md new file mode 100644 index 0000000..7f44abb --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/ui/hide-toast.md @@ -0,0 +1,153 @@ +# uni.hideToast - 隐藏消息提示示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/ui/prompt.html#hidetoast + +## 概述 + +`uni.hideToast` 用于隐藏消息提示框。 + +## 基础用法 + +```javascript +uni.hideToast() +``` + +## 完整示例 + +### 示例 1: 基本使用 + +```javascript +// 显示提示 +uni.showToast({ + title: '操作成功', + icon: 'success' +}) + +// 提前隐藏 +setTimeout(() => { + uni.hideToast() +}, 1000) +``` + +### 示例 2: 手动控制提示显示时间 + +```javascript +function showCustomToast(title, duration = 2000) { + uni.showToast({ + title: title, + icon: 'none', + duration: duration + }) + + // 如果需要提前隐藏 + setTimeout(() => { + uni.hideToast() + }, duration - 500) +} +``` + +### 示例 3: 在页面中使用 + +```vue + + + +``` + +### 示例 4: 替换提示内容 + +```javascript +function showReplacingToast(messages) { + let currentIndex = 0 + + const showNext = () => { + if (currentIndex < messages.length) { + uni.showToast({ + title: messages[currentIndex], + icon: 'none', + duration: 2000 + }) + currentIndex++ + + setTimeout(() => { + uni.hideToast() + setTimeout(showNext, 100) + }, 2000) + } + } + + showNext() +} + +// 使用 +showReplacingToast(['消息1', '消息2', '消息3']) +``` + +### 示例 5: 确保隐藏提示 + +```javascript +function showTemporaryToast(title) { + uni.showToast({ + title: title, + icon: 'none', + duration: 3000 + }) + + // 3秒后自动隐藏 + setTimeout(() => { + uni.hideToast() + }, 3000) +} +``` + +## 参数说明 + +此 API 无需参数。 + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. 用于提前隐藏通过 `uni.showToast` 显示的提示 +2. 如果不调用,提示会在 `duration` 时间后自动消失 +3. 建议在需要立即隐藏提示时使用 +4. 通常不需要手动调用,除非需要提前隐藏 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/ui/prompt.html#hidetoast +- **显示提示**: https://doc.dcloud.net.cn/uni-app-x/api/ui/prompt.html#showtoast diff --git a/.agents/bak-skills/uniappx-project/examples/api/ui/remove-tab-bar-badge.md b/.agents/bak-skills/uniappx-project/examples/api/ui/remove-tab-bar-badge.md new file mode 100644 index 0000000..6d798f6 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/ui/remove-tab-bar-badge.md @@ -0,0 +1,171 @@ +# uni.removeTabBarBadge - 移除 TabBar 徽标示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/ui/tab-bar.html#removetabbarbadge + +## 概述 + +`uni.removeTabBarBadge` 用于移除 tabBar 某一项右上角的文本。 + +## 基础用法 + +```javascript +uni.removeTabBarBadge({ + index: 0 +}) +``` + +## 完整示例 + +### 示例 1: 清除徽标 + +```javascript +uni.removeTabBarBadge({ + index: 0, // tabBar 的哪一项,从左边算起 + success: () => { + console.log('清除成功') + }, + fail: (err) => { + console.error('清除失败', err) + } +}) +``` + +### 示例 2: 清除未读消息徽标 + +```javascript +function clearUnreadBadge() { + uni.removeTabBarBadge({ + index: 1, // 消息页面的索引 + success: () => { + console.log('未读消息徽标已清除') + } + }) +} +``` + +### 示例 3: 在页面中使用 + +```vue + + + +``` + +### 示例 4: 阅读消息后清除 + +```vue + + + +``` + +### 示例 5: 清除所有徽标 + +```javascript +function clearAllBadges(tabBarCount) { + for (let i = 0; i < tabBarCount; i++) { + uni.removeTabBarBadge({ + index: i + }) + } +} + +// 使用(假设有4个tabBar) +clearAllBadges(4) +``` + +## 参数说明 + +| 参数名 | 类型 | 必填 | 说明 | +|--------|------|------|------| +| index | Number | 是 | tabBar 的哪一项,从左边算起 | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. `index` 从 0 开始,对应 `pages.json` 中 tabBar 的配置顺序 +2. 如果该 tabBar 项没有徽标,调用此 API 不会报错 +3. 建议在消息已读或数量为 0 时清除徽标 +4. 与 `setTabBarBadge` 配合使用 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/ui/tab-bar.html#removetabbarbadge +- **设置徽标**: https://doc.dcloud.net.cn/uni-app-x/api/ui/tab-bar.html#settabbarbadge diff --git a/.agents/bak-skills/uniappx-project/examples/api/ui/set-navigation-bar-color.md b/.agents/bak-skills/uniappx-project/examples/api/ui/set-navigation-bar-color.md new file mode 100644 index 0000000..fad37ef --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/ui/set-navigation-bar-color.md @@ -0,0 +1,180 @@ +# uni.setNavigationBarColor - 设置导航栏颜色示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/ui/navigation-bar.html#setnavigationbarcolor + +## 概述 + +`uni.setNavigationBarColor` 用于设置页面导航栏颜色。 + +## 基础用法 + +```javascript +uni.setNavigationBarColor({ + frontColor: '#ffffff', + backgroundColor: '#007aff' +}) +``` + +## 完整示例 + +### 示例 1: 设置导航栏颜色 + +```javascript +uni.setNavigationBarColor({ + frontColor: '#ffffff', // 前景颜色,包括按钮、标题、状态栏的颜色 + backgroundColor: '#007aff', // 背景颜色 + success: () => { + console.log('设置成功') + } +}) +``` + +### 示例 2: 深色主题 + +```javascript +uni.setNavigationBarColor({ + frontColor: '#ffffff', + backgroundColor: '#000000', + animation: { + duration: 400, + timingFunc: 'easeIn' + } +}) +``` + +### 示例 3: 浅色主题 + +```javascript +uni.setNavigationBarColor({ + frontColor: '#000000', + backgroundColor: '#ffffff', + animation: { + duration: 400, + timingFunc: 'easeIn' + } +}) +``` + +### 示例 4: 在页面中使用 + +```vue + + + +``` + +### 示例 5: 根据内容动态设置 + +```vue + + + +``` + +## 参数说明 + +| 参数名 | 类型 | 必填 | 说明 | +|--------|------|------|------| +| frontColor | String | 是 | 前景颜色值,包括按钮、标题、状态栏的颜色,仅支持 #ffffff 和 #000000 | +| backgroundColor | String | 是 | 背景颜色值,有效值为十六进制颜色 | +| animation | Object | 否 | 动画效果 | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. `frontColor` 仅支持 `#ffffff` 和 `#000000` +2. `backgroundColor` 支持任意十六进制颜色 +3. 可以通过 `animation` 设置颜色切换动画 +4. 建议与页面主题色保持一致 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/ui/navigation-bar.html#setnavigationbarcolor +- **设置标题**: https://doc.dcloud.net.cn/uni-app-x/api/ui/navigation-bar.html#setnavigationbartitle diff --git a/.agents/bak-skills/uniappx-project/examples/api/ui/set-navigation-bar-title.md b/.agents/bak-skills/uniappx-project/examples/api/ui/set-navigation-bar-title.md new file mode 100644 index 0000000..8a973d7 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/ui/set-navigation-bar-title.md @@ -0,0 +1,191 @@ +# uni.setNavigationBarTitle - 设置导航栏标题示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/ui/navigation-bar.html#setnavigationbartitle + +## 概述 + +`uni.setNavigationBarTitle` 用于设置当前页面导航栏标题。 + +## 基础用法 + +```javascript +uni.setNavigationBarTitle({ + title: '新标题' +}) +``` + +## 完整示例 + +### 示例 1: 设置标题 + +```javascript +uni.setNavigationBarTitle({ + title: '我的页面', + success: () => { + console.log('设置成功') + }, + fail: (err) => { + console.error('设置失败', err) + } +}) +``` + +### 示例 2: 动态设置标题 + +```vue + + + +``` + +### 示例 3: 在页面生命周期中设置 + +```vue + + + +``` + +### 示例 4: 根据数据设置标题 + +```vue + + + +``` + +### 示例 5: 封装设置标题函数 + +```javascript +// utils/navigation.js +const navigation = { + setTitle(title) { + uni.setNavigationBarTitle({ + title: title + }) + }, + + setTitleWithSubtitle(mainTitle, subtitle) { + const fullTitle = subtitle ? `${mainTitle} - ${subtitle}` : mainTitle + uni.setNavigationBarTitle({ + title: fullTitle + }) + } +} + +// 使用 +navigation.setTitle('我的页面') +navigation.setTitleWithSubtitle('商品', '详情') +``` + +## 参数说明 + +| 参数名 | 类型 | 必填 | 说明 | +|--------|------|------|------| +| title | String | 是 | 页面标题 | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. 标题长度建议不超过 10 个字符 +2. 可以在 `onLoad` 或 `onReady` 中设置 +3. 设置后立即生效 +4. 建议根据页面内容动态设置标题 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/ui/navigation-bar.html#setnavigationbartitle +- **设置导航栏颜色**: https://doc.dcloud.net.cn/uni-app-x/api/ui/navigation-bar.html#setnavigationbarcolor diff --git a/.agents/bak-skills/uniappx-project/examples/api/ui/set-tab-bar-badge.md b/.agents/bak-skills/uniappx-project/examples/api/ui/set-tab-bar-badge.md new file mode 100644 index 0000000..5498bdf --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/ui/set-tab-bar-badge.md @@ -0,0 +1,205 @@ +# uni.setTabBarBadge - 设置 TabBar 徽标示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/ui/tab-bar.html#settabbarbadge + +## 概述 + +`uni.setTabBarBadge` 用于为 tabBar 某一项的右上角添加文本。 + +## 基础用法 + +```javascript +uni.setTabBarBadge({ + index: 0, + text: '1' +}) +``` + +## 完整示例 + +### 示例 1: 设置徽标 + +```javascript +uni.setTabBarBadge({ + index: 0, // tabBar 的哪一项,从左边算起 + text: '5' // 显示的文本,超过 3 个字符则显示成 "..." +}) +``` + +### 示例 2: 显示未读消息数 + +```javascript +function updateUnreadCount(count) { + if (count > 0) { + const text = count > 99 ? '99+' : String(count) + uni.setTabBarBadge({ + index: 1, // 消息页面的索引 + text: text + }) + } else { + // 清除徽标 + uni.removeTabBarBadge({ + index: 1 + }) + } +} + +// 使用 +updateUnreadCount(5) // 显示 "5" +updateUnreadCount(100) // 显示 "99+" +updateUnreadCount(0) // 清除徽标 +``` + +### 示例 3: 在页面中使用 + +```vue + + + +``` + +### 示例 4: 实时更新未读消息 + +```vue + + + +``` + +### 示例 5: 多个 TabBar 徽标 + +```javascript +function updateAllTabBarBadges(badges) { + // badges: [{ index: 0, text: '5' }, { index: 1, text: '10' }] + badges.forEach(badge => { + if (badge.text && badge.text !== '0') { + uni.setTabBarBadge({ + index: badge.index, + text: badge.text + }) + } else { + uni.removeTabBarBadge({ + index: badge.index + }) + } + }) +} + +// 使用 +updateAllTabBarBadges([ + { index: 0, text: '5' }, + { index: 1, text: '10' }, + { index: 2, text: '0' } // 清除 +]) +``` + +## 参数说明 + +| 参数名 | 类型 | 必填 | 说明 | +|--------|------|------|------| +| index | Number | 是 | tabBar 的哪一项,从左边算起 | +| text | String | 是 | 显示的文本,超过 3 个字符则显示成 "..." | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. `index` 从 0 开始,对应 `pages.json` 中 tabBar 的配置顺序 +2. `text` 超过 3 个字符会显示成 "..." +3. 建议数字超过 99 时显示 "99+" +4. 使用 `removeTabBarBadge` 可以清除徽标 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/ui/tab-bar.html#settabbarbadge +- **清除徽标**: https://doc.dcloud.net.cn/uni-app-x/api/ui/tab-bar.html#removetabbarbadge diff --git a/.agents/bak-skills/uniappx-project/examples/api/ui/set-tab-bar-style.md b/.agents/bak-skills/uniappx-project/examples/api/ui/set-tab-bar-style.md new file mode 100644 index 0000000..72e893d --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/ui/set-tab-bar-style.md @@ -0,0 +1,168 @@ +# uni.setTabBarStyle - 设置 TabBar 样式示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/ui/tab-bar.html#settabbarstyle + +## 概述 + +`uni.setTabBarStyle` 用于动态设置 tabBar 的整体样式。 + +## 基础用法 + +```javascript +uni.setTabBarStyle({ + color: '#7A7E83', + selectedColor: '#3cc51f', + backgroundColor: '#ffffff' +}) +``` + +## 完整示例 + +### 示例 1: 设置 TabBar 样式 + +```javascript +uni.setTabBarStyle({ + color: '#7A7E83', // 未选中时的文字颜色 + selectedColor: '#3cc51f', // 选中时的文字颜色 + backgroundColor: '#ffffff', // 背景颜色 + borderStyle: 'black', // 边框颜色 + success: () => { + console.log('设置成功') + } +}) +``` + +### 示例 2: 深色主题 + +```javascript +function setDarkTheme() { + uni.setTabBarStyle({ + color: '#999999', + selectedColor: '#ffffff', + backgroundColor: '#000000', + borderStyle: 'white' + }) +} +``` + +### 示例 3: 浅色主题 + +```javascript +function setLightTheme() { + uni.setTabBarStyle({ + color: '#7A7E83', + selectedColor: '#007aff', + backgroundColor: '#ffffff', + borderStyle: 'black' + }) +} +``` + +### 示例 4: 在页面中使用 + +```vue + + + +``` + +### 示例 5: 根据系统主题设置 + +```javascript +function setTabBarThemeBySystem() { + uni.getSystemInfo({ + success: (res) => { + // 根据系统主题设置(需要自己判断) + const isDark = res.theme === 'dark' // 某些平台支持 + + if (isDark) { + uni.setTabBarStyle({ + color: '#999999', + selectedColor: '#ffffff', + backgroundColor: '#000000', + borderStyle: 'white' + }) + } else { + uni.setTabBarStyle({ + color: '#7A7E83', + selectedColor: '#007aff', + backgroundColor: '#ffffff', + borderStyle: 'black' + }) + } + } + }) +} +``` + +## 参数说明 + +| 参数名 | 类型 | 必填 | 说明 | +|--------|------|------|------| +| color | String | 否 | tab 上的文字默认颜色 | +| selectedColor | String | 否 | tab 上的文字选中时的颜色 | +| backgroundColor | String | 否 | tab 的背景色 | +| borderStyle | String | 否 | tabbar 上边框的颜色,可选值:black、white | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. 设置后立即生效 +2. `color` 和 `selectedColor` 建议使用对比度高的颜色 +3. `borderStyle` 可选值为 `black` 或 `white` +4. 建议与页面主题色保持一致 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/ui/tab-bar.html#settabbarstyle +- **设置 TabBar 项**: https://doc.dcloud.net.cn/uni-app-x/api/ui/tab-bar.html#settabbaritem diff --git a/.agents/bak-skills/uniappx-project/examples/api/ui/show-action-sheet.md b/.agents/bak-skills/uniappx-project/examples/api/ui/show-action-sheet.md new file mode 100644 index 0000000..9e32134 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/ui/show-action-sheet.md @@ -0,0 +1,217 @@ +# uni.showActionSheet - 操作菜单示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/ui/prompt.html#showactionsheet + +## 概述 + +`uni.showActionSheet` 用于显示操作菜单,从底部弹出选择项。 + +## 基础用法 + +```javascript +uni.showActionSheet({ + itemList: ['选项1', '选项2', '选项3'], + success: (res) => { + console.log('选择了第', res.tapIndex, '个选项') + } +}) +``` + +## 完整示例 + +### 示例 1: 基本操作菜单 + +```javascript +uni.showActionSheet({ + itemList: ['拍照', '从相册选择', '取消'], + success: (res) => { + if (res.tapIndex === 0) { + // 拍照 + console.log('选择拍照') + } else if (res.tapIndex === 1) { + // 从相册选择 + console.log('从相册选择') + } + } +}) +``` + +### 示例 2: 图片选择 + +```javascript +uni.showActionSheet({ + itemList: ['拍照', '从相册选择'], + success: (res) => { + if (res.tapIndex === 0) { + // 拍照 + uni.chooseImage({ + count: 1, + sourceType: ['camera'], + success: (imageRes) => { + console.log('拍照成功', imageRes.tempFilePaths) + } + }) + } else if (res.tapIndex === 1) { + // 从相册选择 + uni.chooseImage({ + count: 1, + sourceType: ['album'], + success: (imageRes) => { + console.log('选择成功', imageRes.tempFilePaths) + } + }) + } + } +}) +``` + +### 示例 3: 分享功能 + +```javascript +uni.showActionSheet({ + itemList: ['分享到微信', '分享到朋友圈', '复制链接'], + success: (res) => { + switch (res.tapIndex) { + case 0: + // 分享到微信 + uni.share({ + provider: 'weixin', + scene: 'WXSceneSession' + }) + break + case 1: + // 分享到朋友圈 + uni.share({ + provider: 'weixin', + scene: 'WXSceneTimeline' + }) + break + case 2: + // 复制链接 + uni.setClipboardData({ + data: 'https://example.com', + success: () => { + uni.showToast({ + title: '链接已复制', + icon: 'success' + }) + } + }) + break + } + } +}) +``` + +### 示例 4: 在页面中使用 + +```vue + + + +``` + +### 示例 5: 带取消按钮 + +```javascript +uni.showActionSheet({ + itemList: ['选项1', '选项2', '选项3'], + success: (res) => { + console.log('选择了', res.tapIndex) + }, + fail: (res) => { + console.log('取消选择') + } +}) +``` + +## 参数说明 + +| 参数名 | 类型 | 必填 | 说明 | +|--------|------|------|------| +| itemList | Array | 是 | 按钮的文字数组 | +| itemColor | String | 否 | 按钮的文字颜色 | + +## 返回值 + +| 参数名 | 类型 | 说明 | +|--------|------|------| +| tapIndex | Number | 用户点击的按钮序号,从上到下的顺序,从0开始 | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. `itemList` 数组最多支持 6 个选项 +2. 用户点击取消或遮罩层会触发 fail 回调 +3. `tapIndex` 从 0 开始,对应 `itemList` 的索引 +4. 建议将"取消"选项放在最后 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/ui/prompt.html#showactionsheet +- **模态弹窗**: https://doc.dcloud.net.cn/uni-app-x/api/ui/prompt.html#showmodal diff --git a/.agents/bak-skills/uniappx-project/examples/api/ui/show-loading.md b/.agents/bak-skills/uniappx-project/examples/api/ui/show-loading.md new file mode 100644 index 0000000..ec720a7 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/ui/show-loading.md @@ -0,0 +1,189 @@ +# uni.showLoading - 加载提示示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/ui/prompt.html#showloading + +## 概述 + +`uni.showLoading` 用于显示加载提示框,常用于异步操作时显示加载状态。 + +## 基础用法 + +```javascript +uni.showLoading({ + title: '加载中...' +}) +``` + +## 完整示例 + +### 示例 1: 基本加载提示 + +```javascript +uni.showLoading({ + title: '加载中...', + mask: true +}) + +// 操作完成后隐藏 +setTimeout(() => { + uni.hideLoading() +}, 2000) +``` + +### 示例 2: 网络请求时显示加载 + +```javascript +uni.showLoading({ + title: '加载中...', + mask: true +}) + +uni.request({ + url: 'https://api.example.com/data', + success: (res) => { + console.log('数据', res.data) + }, + complete: () => { + uni.hideLoading() + } +}) +``` + +### 示例 3: 在页面中使用 + +```vue + + + +``` + +### 示例 4: 封装加载函数 + +```javascript +// utils/loading.js +const loading = { + show(title = '加载中...') { + uni.showLoading({ + title: title, + mask: true + }) + }, + + hide() { + uni.hideLoading() + }, + + async withLoading(fn, title = '加载中...') { + this.show(title) + try { + const result = await fn() + return result + } finally { + this.hide() + } + } +} + +// 使用 +loading.withLoading(async () => { + const data = await fetchData() + return data +}, '加载数据中...') +``` + +### 示例 5: 配合请求使用 + +```javascript +// 显示加载 +uni.showLoading({ + title: '提交中...', + mask: true +}) + +// 提交数据 +uni.request({ + url: 'https://api.example.com/submit', + method: 'POST', + data: { name: 'test' }, + success: (res) => { + uni.hideLoading() + uni.showToast({ + title: '提交成功', + icon: 'success' + }) + }, + fail: (err) => { + uni.hideLoading() + uni.showToast({ + title: '提交失败', + icon: 'none' + }) + } +}) +``` + +## 参数说明 + +| 参数名 | 类型 | 必填 | 说明 | +|--------|------|------|------| +| title | String | 是 | 提示的内容 | +| mask | Boolean | 否 | 是否显示透明蒙层,防止触摸穿透 | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. 必须调用 `uni.hideLoading()` 才能关闭加载提示 +2. `mask: true` 可以防止用户在加载时操作页面 +3. 建议在异步操作的开始显示,在完成时隐藏 +4. 不要在 `success` 回调中忘记调用 `hideLoading` + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/ui/prompt.html#showloading +- **隐藏加载**: https://doc.dcloud.net.cn/uni-app-x/api/ui/prompt.html#hideloading diff --git a/.agents/bak-skills/uniappx-project/examples/api/ui/show-modal.md b/.agents/bak-skills/uniappx-project/examples/api/ui/show-modal.md new file mode 100644 index 0000000..9100863 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/ui/show-modal.md @@ -0,0 +1,226 @@ +# uni.showModal - 模态弹窗示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/ui/prompt.html#showmodal + +## 概述 + +`uni.showModal` 用于显示模态弹窗,常用于确认操作。 + +## 基础用法 + +```javascript +uni.showModal({ + title: '提示', + content: '确定要删除吗?', + success: (res) => { + if (res.confirm) { + console.log('用户点击确定') + } else if (res.cancel) { + console.log('用户点击取消') + } + } +}) +``` + +## 完整示例 + +### 示例 1: 确认删除 + +```javascript +uni.showModal({ + title: '提示', + content: '确定要删除这条记录吗?', + confirmText: '删除', + cancelText: '取消', + success: (res) => { + if (res.confirm) { + // 执行删除操作 + console.log('确认删除') + } + } +}) +``` + +### 示例 2: 自定义按钮文字 + +```javascript +uni.showModal({ + title: '提示', + content: '确定要退出登录吗?', + confirmText: '退出', + cancelText: '取消', + confirmColor: '#ff3b30', + success: (res) => { + if (res.confirm) { + // 退出登录 + uni.removeStorageSync('token') + uni.reLaunch({ + url: '/pages/login/login' + }) + } + } +}) +``` + +### 示例 3: 只显示确定按钮 + +```javascript +uni.showModal({ + title: '提示', + content: '操作成功', + showCancel: false, + success: (res) => { + if (res.confirm) { + console.log('用户点击确定') + } + } +}) +``` + +### 示例 4: 在页面中使用 + +```vue + + + +``` + +### 示例 5: 封装确认函数 + +```javascript +// utils/modal.js +const modal = { + confirm(title, content) { + return new Promise((resolve, reject) => { + uni.showModal({ + title: title, + content: content, + success: (res) => { + if (res.confirm) { + resolve(true) + } else { + resolve(false) + } + }, + fail: (err) => { + reject(err) + } + }) + }) + }, + + alert(title, content) { + return new Promise((resolve) => { + uni.showModal({ + title: title, + content: content, + showCancel: false, + success: () => { + resolve() + } + }) + }) + } +} + +// 使用 +const result = await modal.confirm('提示', '确定要删除吗?') +if (result) { + console.log('用户确认') +} else { + console.log('用户取消') +} +``` + +## 参数说明 + +| 参数名 | 类型 | 必填 | 说明 | +|--------|------|------|------| +| title | String | 否 | 提示的标题 | +| content | String | 否 | 提示的内容 | +| showCancel | Boolean | 否 | 是否显示取消按钮,默认 true | +| cancelText | String | 否 | 取消按钮的文字,默认"取消" | +| cancelColor | String | 否 | 取消按钮的文字颜色 | +| confirmText | String | 否 | 确认按钮的文字,默认"确定" | +| confirmColor | String | 否 | 确认按钮的文字颜色 | + +## 返回值 + +| 参数名 | 类型 | 说明 | +|--------|------|------| +| confirm | Boolean | 为 true 时,表示用户点击了确定按钮 | +| cancel | Boolean | 为 true 时,表示用户点击了取消按钮 | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. `title` 和 `content` 至少需要提供一个 +2. 确认和取消按钮的文字可以自定义 +3. 可以通过 `showCancel: false` 只显示确定按钮 +4. 建议用于重要的确认操作 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/ui/prompt.html#showmodal +- **消息提示**: https://doc.dcloud.net.cn/uni-app-x/api/ui/prompt.html#showtoast diff --git a/.agents/bak-skills/uniappx-project/examples/api/ui/show-navigation-bar-loading.md b/.agents/bak-skills/uniappx-project/examples/api/ui/show-navigation-bar-loading.md new file mode 100644 index 0000000..d4c8b78 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/ui/show-navigation-bar-loading.md @@ -0,0 +1,194 @@ +# uni.showNavigationBarLoading - 显示导航栏加载动画示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/ui/navigation-bar.html#shownavigationbarloading + +## 概述 + +`uni.showNavigationBarLoading` 用于在当前页面导航栏显示加载动画。 + +## 基础用法 + +```javascript +uni.showNavigationBarLoading() +``` + +## 完整示例 + +### 示例 1: 基本使用 + +```javascript +// 显示加载动画 +uni.showNavigationBarLoading() + +// 隐藏加载动画 +setTimeout(() => { + uni.hideNavigationBarLoading() +}, 2000) +``` + +### 示例 2: 网络请求时显示 + +```javascript +// 显示加载动画 +uni.showNavigationBarLoading() + +uni.request({ + url: 'https://api.example.com/data', + success: (res) => { + console.log('数据', res.data) + }, + complete: () => { + // 请求完成后隐藏 + uni.hideNavigationBarLoading() + } +}) +``` + +### 示例 3: 在页面中使用 + +```vue + + + +``` + +### 示例 4: 封装加载函数 + +```javascript +// utils/loading.js +const loading = { + showNavBar() { + uni.showNavigationBarLoading() + }, + + hideNavBar() { + uni.hideNavigationBarLoading() + }, + + async withNavBarLoading(fn) { + this.showNavBar() + try { + const result = await fn() + return result + } finally { + this.hideNavBar() + } + } +} + +// 使用 +loading.withNavBarLoading(async () => { + const data = await fetchData() + return data +}) +``` + +### 示例 5: 页面刷新时显示 + +```vue + + + +``` + +## 参数说明 + +此 API 无需参数。 + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. 必须与 `uni.hideNavigationBarLoading` 配对使用 +2. 在导航栏标题旁边显示加载动画 +3. 适合页面级别的加载状态 +4. 建议在 `complete` 回调中隐藏 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/ui/navigation-bar.html#shownavigationbarloading +- **隐藏加载**: https://doc.dcloud.net.cn/uni-app-x/api/ui/navigation-bar.html#hidenavigationbarloading diff --git a/.agents/bak-skills/uniappx-project/examples/api/ui/show-tab-bar-red-dot.md b/.agents/bak-skills/uniappx-project/examples/api/ui/show-tab-bar-red-dot.md new file mode 100644 index 0000000..e52ae7a --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/ui/show-tab-bar-red-dot.md @@ -0,0 +1,199 @@ +# uni.showTabBarRedDot - 显示 TabBar 红点示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/ui/tab-bar.html#showtabbarreddot + +## 概述 + +`uni.showTabBarRedDot` 用于显示 tabBar 某一项的右上角的红点。 + +## 基础用法 + +```javascript +uni.showTabBarRedDot({ + index: 0 +}) +``` + +## 完整示例 + +### 示例 1: 显示红点 + +```javascript +uni.showTabBarRedDot({ + index: 0, // tabBar 的哪一项,从左边算起 + success: () => { + console.log('显示成功') + }, + fail: (err) => { + console.error('显示失败', err) + } +}) +``` + +### 示例 2: 显示消息红点 + +```javascript +function showMessageRedDot() { + uni.showTabBarRedDot({ + index: 1, // 消息页面的索引 + success: () => { + console.log('消息红点已显示') + } + }) +} +``` + +### 示例 3: 在页面中使用 + +```vue + + + +``` + +### 示例 4: 根据状态显示红点 + +```vue + + + +``` + +### 示例 5: 多个 TabBar 红点 + +```javascript +function showAllRedDots(indices) { + indices.forEach(index => { + uni.showTabBarRedDot({ + index: index + }) + }) +} + +// 使用 +showAllRedDots([0, 1, 2]) // 显示第0、1、2项的红点 +``` + +## 参数说明 + +| 参数名 | 类型 | 必填 | 说明 | +|--------|------|------|------| +| index | Number | 是 | tabBar 的哪一项,从左边算起 | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. `index` 从 0 开始,对应 `pages.json` 中 tabBar 的配置顺序 +2. 红点不显示数字,只显示一个小红点 +3. 与 `setTabBarBadge` 的区别:红点不显示文字,徽标显示文字 +4. 使用 `hideTabBarRedDot` 可以隐藏红点 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/ui/tab-bar.html#showtabbarreddot +- **隐藏红点**: https://doc.dcloud.net.cn/uni-app-x/api/ui/tab-bar.html#hidetabbarreddot +- **设置徽标**: https://doc.dcloud.net.cn/uni-app-x/api/ui/tab-bar.html#settabbarbadge diff --git a/.agents/bak-skills/uniappx-project/examples/api/ui/show-toast.md b/.agents/bak-skills/uniappx-project/examples/api/ui/show-toast.md new file mode 100644 index 0000000..173d88d --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/api/ui/show-toast.md @@ -0,0 +1,188 @@ +# uni.showToast - 消息提示示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/api/ui/prompt.html#showtoast + +## 概述 + +`uni.showToast` 用于显示消息提示框,常用于操作反馈。 + +## 基础用法 + +```javascript +uni.showToast({ + title: '操作成功', + icon: 'success' +}) +``` + +## 完整示例 + +### 示例 1: 成功提示 + +```javascript +uni.showToast({ + title: '操作成功', + icon: 'success', + duration: 2000 +}) +``` + +### 示例 2: 错误提示 + +```javascript +uni.showToast({ + title: '操作失败', + icon: 'error', + duration: 2000 +}) +``` + +### 示例 3: 加载提示 + +```javascript +uni.showToast({ + title: '加载中...', + icon: 'loading', + duration: 2000 +}) +``` + +### 示例 4: 无图标提示 + +```javascript +uni.showToast({ + title: '这是一条消息', + icon: 'none', + duration: 2000 +}) +``` + +### 示例 5: 自定义图片 + +```javascript +uni.showToast({ + title: '自定义图标', + image: '/static/custom-icon.png', + duration: 2000 +}) +``` + +### 示例 6: 封装提示函数 + +```javascript +// utils/toast.js +const toast = { + success(title, duration = 2000) { + uni.showToast({ + title: title, + icon: 'success', + duration: duration + }) + }, + + error(title, duration = 2000) { + uni.showToast({ + title: title, + icon: 'error', + duration: duration + }) + }, + + loading(title, duration = 2000) { + uni.showToast({ + title: title, + icon: 'loading', + duration: duration + }) + }, + + info(title, duration = 2000) { + uni.showToast({ + title: title, + icon: 'none', + duration: duration + }) + } +} + +// 使用 +toast.success('保存成功') +toast.error('保存失败') +toast.info('这是一条消息') +``` + +### 示例 7: 在页面中使用 + +```vue + + + +``` + +## 参数说明 + +| 参数名 | 类型 | 必填 | 说明 | +|--------|------|------|------| +| title | String | 是 | 提示的内容 | +| icon | String | 否 | 图标类型,可选值:success、error、loading、none | +| image | String | 否 | 自定义图标的本地路径 | +| duration | Number | 否 | 提示的延迟时间,单位 ms,默认 2000 | +| mask | Boolean | 否 | 是否显示透明蒙层,防止触摸穿透 | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. `title` 长度限制:微信小程序最多 7 个汉字长度 +2. 同时只能显示一个 toast,新的 toast 会覆盖旧的 +3. 使用 `uni.hideToast()` 可以手动关闭 toast +4. `mask` 参数在某些平台可能不支持 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/api/ui/prompt.html#showtoast +- **隐藏提示**: https://doc.dcloud.net.cn/uni-app-x/api/ui/prompt.html#hidetoast diff --git a/.agents/bak-skills/uniappx-project/examples/components/built-in/audio.md b/.agents/bak-skills/uniappx-project/examples/components/built-in/audio.md new file mode 100644 index 0000000..0403deb --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/components/built-in/audio.md @@ -0,0 +1,320 @@ +# audio 组件示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/component/audio.html + +## 概述 + +`audio` 是音频播放组件,用于播放音频。 + +## 基础用法 + +```vue + +``` + +## 完整示例 + +### 示例 1: 基本音频播放 + +```vue + + + + + +``` + +### 示例 2: 音频播放控制 + +```vue + + + +``` + +### 示例 3: 音频列表 + +```vue + + + + + +``` + +### 示例 4: 播放进度显示 + +```vue + + + +``` + +### 示例 5: 自定义播放器 + +```vue + + + +``` + +## 属性说明 + +| 属性名 | 类型 | 默认值 | 说明 | +|--------|------|--------|------| +| src | String | - | 要播放音频的资源地址 | +| controls | Boolean | false | 是否显示默认播放控件 | +| autoplay | Boolean | false | 是否自动播放 | +| loop | Boolean | false | 是否循环播放 | +| muted | Boolean | false | 是否静音播放 | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. 音频地址需要配置合法域名 +2. `autoplay` 在某些平台可能不生效 +3. 可以通过事件监听播放状态 +4. 建议使用 `controls` 显示播放控件 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/component/audio.html diff --git a/.agents/bak-skills/uniappx-project/examples/components/built-in/button.md b/.agents/bak-skills/uniappx-project/examples/components/built-in/button.md new file mode 100644 index 0000000..d3faaac --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/components/built-in/button.md @@ -0,0 +1,233 @@ +# button 组件示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/component/button.html + +## 概述 + +`button` 是按钮组件,用于触发操作。 + +## 基础用法 + +```vue + + + +``` + +## 完整示例 + +### 示例 1: 按钮类型 + +```vue + + + +``` + +### 示例 2: 按钮大小 + +```vue + +``` + +### 示例 3: 镂空按钮 + +```vue + +``` + +### 示例 4: 禁用按钮 + +```vue + + + +``` + +### 示例 5: 加载状态 + +```vue + + + +``` + +### 示例 6: 表单提交 + +```vue + + + +``` + +### 示例 7: 开放能力(微信小程序) + +```vue + + + +``` + +## 属性说明 + +| 属性名 | 类型 | 默认值 | 说明 | +|--------|------|--------|------| +| size | String | default | 按钮的大小,可选值:default、mini | +| type | String | default | 按钮的样式类型,可选值:primary、default、warn | +| plain | Boolean | false | 按钮是否镂空,背景色透明 | +| disabled | Boolean | false | 是否禁用 | +| loading | Boolean | false | 名称前是否带 loading 图标 | +| form-type | String | - | 用于 form 组件,可选值:submit、reset | +| open-type | String | - | 开放能力,如:getUserInfo、contact、share 等 | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. `open-type` 在不同平台支持的能力不同 +2. 按钮的样式可以通过 CSS 自定义 +3. `loading` 图标在不同平台显示可能不同 +4. 建议使用 `@click` 事件处理点击,而不是依赖 `open-type` + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/component/button.html +- **表单组件**: https://doc.dcloud.net.cn/uni-app-x/component/form.html diff --git a/.agents/bak-skills/uniappx-project/examples/components/built-in/camera.md b/.agents/bak-skills/uniappx-project/examples/components/built-in/camera.md new file mode 100644 index 0000000..9d17318 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/components/built-in/camera.md @@ -0,0 +1,347 @@ +# camera 组件示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/component/camera.html + +## 概述 + +`camera` 是相机组件,用于调用设备相机进行拍照或录像。 + +## 基础用法 + +```vue + + + +``` + +## 完整示例 + +### 示例 1: 基本相机 + +```vue + + + + + +``` + +### 示例 2: 拍照和录像 + +```vue + + + +``` + +### 示例 3: 切换摄像头和闪光灯 + +```vue + + + +``` + +### 示例 4: 拍照并上传 + +```vue + + + +``` + +### 示例 5: 自定义相机界面 + +```vue + + + + + +``` + +## 属性说明 + +| 属性名 | 类型 | 默认值 | 说明 | +|--------|------|--------|------| +| device-position | String | back | 摄像头朝向,可选值:back、front | +| flash | String | off | 闪光灯,可选值:on、off、auto、torch | +| frame-size | String | medium | 指定期望的相机帧数据尺寸,可选值:small、medium、large | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ❌ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. H5 平台不支持此组件 +2. 需要通过 `uni.createCameraContext` 创建相机上下文 +3. 拍照和录像需要通过上下文方法调用 +4. 建议全屏显示相机组件 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/component/camera.html +- **Camera API**: https://doc.dcloud.net.cn/uni-app-x/api/media/camera.html diff --git a/.agents/bak-skills/uniappx-project/examples/components/built-in/canvas.md b/.agents/bak-skills/uniappx-project/examples/components/built-in/canvas.md new file mode 100644 index 0000000..c4edf98 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/components/built-in/canvas.md @@ -0,0 +1,247 @@ +# canvas 组件示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/component/canvas.html + +## 概述 + +`canvas` 是画布组件,用于绘制图形、文字等。 + +## 基础用法 + +```vue + + + + + +``` + +## 完整示例 + +### 示例 1: 绘制矩形 + +```vue + + + + + +``` + +### 示例 2: 绘制圆形 + +```vue + + + +``` + +### 示例 3: 绘制文字 + +```vue + + + +``` + +### 示例 4: 绘制图片 + +```vue + + + +``` + +### 示例 5: 保存为图片 + +```vue + + + +``` + +## 属性说明 + +| 属性名 | 类型 | 默认值 | 说明 | +|--------|------|--------|------| +| canvas-id | String | - | canvas 组件的唯一标识符 | +| disable-scroll | Boolean | false | 当在 canvas 中移动时且有绑定手势事件时,禁止屏幕滚动以及下拉刷新 | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. 需要在 `onReady` 生命周期中绘制 +2. 调用 `ctx.draw()` 才会真正绘制到画布上 +3. 可以通过 `uni.canvasToTempFilePath` 将画布转为图片 +4. 不同平台的 API 可能略有差异 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/component/canvas.html +- **Canvas API**: https://doc.dcloud.net.cn/uni-app-x/api/canvas/canvas.html diff --git a/.agents/bak-skills/uniappx-project/examples/components/built-in/checkbox.md b/.agents/bak-skills/uniappx-project/examples/components/built-in/checkbox.md new file mode 100644 index 0000000..6ae1c81 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/components/built-in/checkbox.md @@ -0,0 +1,233 @@ +# checkbox 组件示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/component/checkbox.html + +## 概述 + +`checkbox` 是多项选择器组件,用于多选场景。 + +## 基础用法 + +```vue + +``` + +## 完整示例 + +### 示例 1: 单个复选框 + +```vue + + + +``` + +### 示例 2: 复选框组 + +```vue + + + + + +``` + +### 示例 3: 全选功能 + +```vue + + + +``` + +### 示例 4: 在表单中使用 + +```vue + + + +``` + +## 属性说明 + +| 属性名 | 类型 | 默认值 | 说明 | +|--------|------|--------|------| +| value | String | - | checkbox 标识,选中时触发 change 事件,并携带 value | +| checked | Boolean | false | 当前是否选中 | +| disabled | Boolean | false | 是否禁用 | +| color | String | #007aff | checkbox 的颜色 | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. 需要配合 `checkbox-group` 使用才能获取选中的值 +2. `value` 用于标识不同的选项 +3. `checked` 属性控制选中状态 +4. 可以通过 `@change` 事件监听变化 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/component/checkbox.html +- **表单组件**: https://doc.dcloud.net.cn/uni-app-x/component/form.html diff --git a/.agents/bak-skills/uniappx-project/examples/components/built-in/form.md b/.agents/bak-skills/uniappx-project/examples/components/built-in/form.md new file mode 100644 index 0000000..9f4f156 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/components/built-in/form.md @@ -0,0 +1,321 @@ +# form 组件示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/component/form.html + +## 概述 + +`form` 是表单组件,用于收集用户输入的数据。 + +## 基础用法 + +```vue + + + +``` + +## 完整示例 + +### 示例 1: 基本表单 + +```vue + + + + + +``` + +### 示例 2: 完整登录表单 + +```vue + + + +``` + +### 示例 3: 表单验证 + +```vue + + + + + +``` + +### 示例 4: 复杂表单 + +```vue + + + +``` + +## 属性说明 + +| 属性名 | 类型 | 默认值 | 说明 | +|--------|------|--------|------| +| report-submit | Boolean | false | 是否返回 formId 用于发送模板消息 | + +## 事件说明 + +| 事件名 | 说明 | 返回值 | +|--------|------|--------| +| @submit | 携带 form 中的数据触发 submit 事件 | e.detail.value 包含所有表单数据 | +| @reset | 表单重置时会触发 reset 事件 | - | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. 表单内的组件需要设置 `name` 属性才能被收集 +2. `form-type="submit"` 的按钮会触发表单提交 +3. `form-type="reset"` 的按钮会重置表单 +4. 可以通过 `e.detail.value` 获取所有表单数据 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/component/form.html +- **输入框**: https://doc.dcloud.net.cn/uni-app-x/component/input.html diff --git a/.agents/bak-skills/uniappx-project/examples/components/built-in/icon.md b/.agents/bak-skills/uniappx-project/examples/components/built-in/icon.md new file mode 100644 index 0000000..e233360 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/components/built-in/icon.md @@ -0,0 +1,160 @@ +# icon 组件示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/component/icon.html + +## 概述 + +`icon` 是图标组件,用于显示各种图标。 + +## 基础用法 + +```vue + +``` + +## 完整示例 + +### 示例 1: 不同类型的图标 + +```vue + + + +``` + +### 示例 2: 不同大小的图标 + +```vue + + + +``` + +### 示例 3: 不同颜色的图标 + +```vue + +``` + +### 示例 4: 在按钮中使用 + +```vue + + + +``` + +## 属性说明 + +| 属性名 | 类型 | 默认值 | 说明 | +|--------|------|--------|------| +| type | String | - | icon 的类型,可选值:success、info、warn、waiting、clear、search 等 | +| size | Number | 23 | icon 的大小,单位 px | +| color | String | - | icon 的颜色,同 CSS 的 color | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. `type` 的值在不同平台可能不同 +2. 建议使用 uni-icons 组件库获得更多图标 +3. `size` 单位为 px,不是 rpx +4. `color` 可以使用任何 CSS 颜色值 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/component/icon.html +- **uni-icons**: https://ext.dcloud.net.cn/plugin?id=28 diff --git a/.agents/bak-skills/uniappx-project/examples/components/built-in/image.md b/.agents/bak-skills/uniappx-project/examples/components/built-in/image.md new file mode 100644 index 0000000..bc8f204 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/components/built-in/image.md @@ -0,0 +1,373 @@ +# image 组件示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/component/image.html + +## 概述 + +`image` 是图片组件,用于显示图片。 + +## 基础用法 + +```vue + +``` + +## 完整示例 + +### 示例 1: 图片显示模式 + +```vue + + + +``` + +### 示例 2: 图片列表 + +```vue + + + + + +``` + +### 示例 3: 图片懒加载 + +```vue + + + + + +``` + +### 示例 4: 图片加载和错误处理 + +```vue + + + + + +``` + +### 示例 5: 占位图和加载状态 + +```vue + + + + + +``` + +### 示例 6: 网络图片和本地图片 + +```vue + + + +``` + +## 属性说明 + +| 属性名 | 类型 | 默认值 | 说明 | +|--------|------|--------|------| +| src | String | - | 图片资源地址 | +| mode | String | scaleToFill | 图片裁剪、缩放的模式 | +| lazy-load | Boolean | false | 图片懒加载 | +| webp | Boolean | false | 是否启用 webp 格式 | + +## mode 可选值 + +| 值 | 说明 | +|----|------| +| scaleToFill | 不保持纵横比缩放图片,使图片的宽高完全拉伸至填满 image 元素 | +| aspectFit | 保持纵横比缩放图片,使图片的长边能完全显示出来 | +| aspectFill | 保持纵横比缩放图片,只保证图片的短边能完全显示出来 | +| widthFix | 宽度不变,高度自动变化,保持原图宽高比不变 | +| heightFix | 高度不变,宽度自动变化,保持原图宽高比不变 | +| top | 不缩放图片,只显示图片的顶部区域 | +| bottom | 不缩放图片,只显示图片的底部区域 | +| center | 不缩放图片,只显示图片的中间区域 | +| left | 不缩放图片,只显示图片的左边区域 | +| right | 不缩放图片,只显示图片的右边区域 | +| top left | 不缩放图片,只显示图片的左上边区域 | +| top right | 不缩放图片,只显示图片的右上边区域 | +| bottom left | 不缩放图片,只显示图片的左下边区域 | +| bottom right | 不缩放图片,只显示图片的右下边区域 | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. 网络图片需要配置合法域名 +2. 本地图片路径需要使用 `/static/` 开头 +3. `lazy-load` 只对 page 和 scroll-view 下的 image 有效 +4. 建议使用合适的 `mode` 值以优化显示效果 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/component/image.html +- **预览图片**: https://doc.dcloud.net.cn/uni-app-x/api/media/image.html#previewimage diff --git a/.agents/bak-skills/uniappx-project/examples/components/built-in/input.md b/.agents/bak-skills/uniappx-project/examples/components/built-in/input.md new file mode 100644 index 0000000..03328a4 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/components/built-in/input.md @@ -0,0 +1,331 @@ +# input 组件示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/component/input.html + +## 概述 + +`input` 是单行输入框组件,用于用户输入文本。 + +## 基础用法 + +```vue + + + +``` + +## 完整示例 + +### 示例 1: 基本输入框 + +```vue + + + +``` + +### 示例 2: 不同类型的输入框 + +```vue + +``` + +### 示例 3: 密码输入框 + +```vue + + + +``` + +### 示例 4: 限制输入长度 + +```vue + + + +``` + +### 示例 5: 获取焦点 + +```vue + + + +``` + +### 示例 6: 确认按钮 + +```vue + + + +``` + +### 示例 7: 表单验证 + +```vue + + + + + +``` + +## 属性说明 + +| 属性名 | 类型 | 默认值 | 说明 | +|--------|------|--------|------| +| value | String | - | 输入框的初始内容 | +| type | String | text | input 的类型,可选值:text、number、digit、idcard、tel、safe-password、nickname | +| password | Boolean | false | 是否是密码类型 | +| placeholder | String | - | 输入框为空时占位符 | +| disabled | Boolean | false | 是否禁用 | +| maxlength | Number | 140 | 最大输入长度,-1 表示不限制 | +| focus | Boolean | false | 获取焦点 | +| confirm-type | String | done | 设置键盘右下角按钮的文字 | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. `v-model` 是双向绑定的推荐方式 +2. `maxlength` 设置为 -1 时不限制最大长度 +3. `focus` 属性在 H5 和 App 上需要特殊处理 +4. `confirm-type` 在不同平台支持的值可能不同 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/component/input.html +- **表单组件**: https://doc.dcloud.net.cn/uni-app-x/component/form.html diff --git a/.agents/bak-skills/uniappx-project/examples/components/built-in/label.md b/.agents/bak-skills/uniappx-project/examples/components/built-in/label.md new file mode 100644 index 0000000..af4e2cf --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/components/built-in/label.md @@ -0,0 +1,262 @@ +# label 组件示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/component/label.html + +## 概述 + +`label` 是标签组件,用于改进表单组件的可用性。 + +## 基础用法 + +```vue + +``` + +## 完整示例 + +### 示例 1: 配合 checkbox 使用 + +```vue + + + + + +``` + +### 示例 2: 配合 radio 使用 + +```vue + + + + + +``` + +### 示例 3: 配合 switch 使用 + +```vue + + + + + +``` + +### 示例 4: 配合 input 使用 + +```vue + + + + + +``` + +### 示例 5: 表单列表 + +```vue + + + + + +``` + +## 属性说明 + +| 属性名 | 类型 | 默认值 | 说明 | +|--------|------|--------|------| +| for | String | - | 绑定控件的 id | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. `label` 用于改进表单组件的可用性 +2. 点击 `label` 内的文本可以触发关联的表单控件 +3. 可以配合 `checkbox`、`radio`、`switch`、`input` 等使用 +4. 建议使用 `label` 包裹表单控件和文本 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/component/label.html +- **复选框**: https://doc.dcloud.net.cn/uni-app-x/component/checkbox.html +- **单选框**: https://doc.dcloud.net.cn/uni-app-x/component/radio.html diff --git a/.agents/bak-skills/uniappx-project/examples/components/built-in/map.md b/.agents/bak-skills/uniappx-project/examples/components/built-in/map.md new file mode 100644 index 0000000..80f5af4 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/components/built-in/map.md @@ -0,0 +1,326 @@ +# map 组件示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/component/map.html + +## 概述 + +`map` 是地图组件,用于显示地图和标记位置。 + +## 基础用法 + +```vue + + + +``` + +## 完整示例 + +### 示例 1: 基本地图 + +```vue + + + + + +``` + +### 示例 2: 地图标记 + +```vue + + + +``` + +### 示例 3: 显示当前位置 + +```vue + + + +``` + +### 示例 4: 地图控件 + +```vue + + + +``` + +### 示例 5: 地图事件 + +```vue + + + +``` + +## 属性说明 + +| 属性名 | 类型 | 默认值 | 说明 | +|--------|------|--------|------| +| latitude | Number | - | 中心纬度 | +| longitude | Number | - | 中心经度 | +| scale | Number | 16 | 缩放级别,取值范围为 5-18 | +| markers | Array | [] | 标记点 | +| show-location | Boolean | false | 显示带有方向的当前定位点 | +| controls | Array | [] | 控件 | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. 需要使用 `gcj02` 类型的坐标 +2. `markers` 数组中的每个标记需要唯一 `id` +3. `show-location` 可以显示当前位置 +4. 可以通过事件监听地图交互 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/component/map.html +- **获取位置**: https://doc.dcloud.net.cn/uni-app-x/api/location/location.html#getlocation diff --git a/.agents/bak-skills/uniappx-project/examples/components/built-in/navigator.md b/.agents/bak-skills/uniappx-project/examples/components/built-in/navigator.md new file mode 100644 index 0000000..7247d1c --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/components/built-in/navigator.md @@ -0,0 +1,204 @@ +# navigator 组件示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/component/navigator.html + +## 概述 + +`navigator` 是页面链接组件,用于页面跳转。 + +## 基础用法 + +```vue + +``` + +## 完整示例 + +### 示例 1: 基本跳转 + +```vue + +``` + +### 示例 2: 带参数跳转 + +```vue + +``` + +### 示例 3: 不同跳转方式 + +```vue + +``` + +### 示例 4: 列表跳转 + +```vue + + + + + +``` + +### 示例 5: 条件跳转 + +```vue + + + +``` + +## 属性说明 + +| 属性名 | 类型 | 默认值 | 说明 | +|--------|------|--------|------| +| url | String | - | 应用内的跳转链接 | +| open-type | String | navigate | 跳转方式,可选值:navigate、redirect、switchTab、reLaunch、navigateBack | +| delta | Number | 1 | 当 open-type 为 navigateBack 时有效,表示返回的页面数 | + +## open-type 可选值 + +| 值 | 说明 | +|----|------| +| navigate | 保留当前页面,跳转到应用内的某个页面 | +| redirect | 关闭当前页面,跳转到应用内的某个页面 | +| switchTab | 跳转到 tabBar 页面 | +| reLaunch | 关闭所有页面,打开到应用内的某个页面 | +| navigateBack | 关闭当前页面,返回上一页面或多级页面 | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. `url` 必须以 `/` 开头 +2. `open-type` 为 `switchTab` 时,只能跳转到 tabBar 页面 +3. `open-type` 为 `navigateBack` 时,不需要 `url` 参数 +4. 可以通过 `delta` 控制返回的页面数 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/component/navigator.html +- **页面路由**: https://doc.dcloud.net.cn/uni-app-x/api/router.html diff --git a/.agents/bak-skills/uniappx-project/examples/components/built-in/picker.md b/.agents/bak-skills/uniappx-project/examples/components/built-in/picker.md new file mode 100644 index 0000000..41a8f8b --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/components/built-in/picker.md @@ -0,0 +1,290 @@ +# picker 组件示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/component/picker.html + +## 概述 + +`picker` 是滚动选择器组件,支持普通选择器、多列选择器、时间选择器、日期选择器等。 + +## 基础用法 + +```vue + + + +``` + +## 完整示例 + +### 示例 1: 普通选择器 + +```vue + + + + + +``` + +### 示例 2: 多列选择器 + +```vue + + + +``` + +### 示例 3: 时间选择器 + +```vue + + + +``` + +### 示例 4: 日期选择器 + +```vue + + + +``` + +### 示例 5: 地区选择器 + +```vue + + + +``` + +## 属性说明 + +| 属性名 | 类型 | 默认值 | 说明 | +|--------|------|--------|------| +| mode | String | selector | 选择器类型,可选值:selector、multiSelector、time、date、region | +| range | Array | [] | mode 为 selector 或 multiSelector 时,range 有效 | +| value | Number/Array | 0 | 表示选择了 range 中的第几个(下标从 0 开始) | +| start | String | - | 有效值范围的开始,字符串格式为 "YYYY-MM-DD" | +| end | String | - | 有效值范围的结束,字符串格式为 "YYYY-MM-DD" | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. `mode` 不同,`range` 和 `value` 的格式也不同 +2. 时间选择器的 `value` 格式为 "HH:mm" +3. 日期选择器的 `value` 格式为 "YYYY-MM-DD" +4. 多列选择器需要配合 `@columnchange` 事件处理联动 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/component/picker.html +- **滚动选择器**: https://doc.dcloud.net.cn/uni-app-x/component/picker-view.html diff --git a/.agents/bak-skills/uniappx-project/examples/components/built-in/progress.md b/.agents/bak-skills/uniappx-project/examples/components/built-in/progress.md new file mode 100644 index 0000000..5da23f8 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/components/built-in/progress.md @@ -0,0 +1,209 @@ +# progress 组件示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/component/progress.html + +## 概述 + +`progress` 是进度条组件,用于显示任务进度。 + +## 基础用法 + +```vue + +``` + +## 完整示例 + +### 示例 1: 基本进度条 + +```vue + + + +``` + +### 示例 2: 显示进度百分比 + +```vue + + + +``` + +### 示例 3: 不同颜色 + +```vue + +``` + +### 示例 4: 文件上传进度 + +```vue + + + +``` + +### 示例 5: 动画进度条 + +```vue + + + +``` + +## 属性说明 + +| 属性名 | 类型 | 默认值 | 说明 | +|--------|------|--------|------| +| percent | Number | 0 | 百分比 0~100 | +| show-info | Boolean | false | 在进度条右侧显示百分比 | +| stroke-width | Number | 6 | 进度条线的宽度,单位 px | +| active | Boolean | false | 进度条是否显示动画 | +| active-color | String | #007aff | 已选择的进度条的颜色 | +| backgroundColor | String | #ebebeb | 未选择的进度条的颜色 | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. `percent` 值范围是 0-100 +2. `show-info` 可以在右侧显示百分比文字 +3. `active` 可以启用动画效果 +4. 可以通过 `active-color` 自定义颜色 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/component/progress.html diff --git a/.agents/bak-skills/uniappx-project/examples/components/built-in/radio.md b/.agents/bak-skills/uniappx-project/examples/components/built-in/radio.md new file mode 100644 index 0000000..f2a1c2a --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/components/built-in/radio.md @@ -0,0 +1,172 @@ +# radio 组件示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/component/radio.html + +## 概述 + +`radio` 是单项选择器组件,用于单选场景。 + +## 基础用法 + +```vue + +``` + +## 完整示例 + +### 示例 1: 单个单选框 + +```vue + + + +``` + +### 示例 2: 单选框组 + +```vue + + + + + +``` + +### 示例 3: 在表单中使用 + +```vue + + + +``` + +## 属性说明 + +| 属性名 | 类型 | 默认值 | 说明 | +|--------|------|--------|------| +| value | String | - | radio 标识,选中时触发 change 事件,并携带 value | +| checked | Boolean | false | 当前是否选中 | +| disabled | Boolean | false | 是否禁用 | +| color | String | #007aff | radio 的颜色 | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. 需要配合 `radio-group` 使用才能获取选中的值 +2. 同一组内只能选择一个选项 +3. `value` 用于标识不同的选项 +4. `checked` 属性控制选中状态 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/component/radio.html +- **表单组件**: https://doc.dcloud.net.cn/uni-app-x/component/form.html diff --git a/.agents/bak-skills/uniappx-project/examples/components/built-in/rich-text.md b/.agents/bak-skills/uniappx-project/examples/components/built-in/rich-text.md new file mode 100644 index 0000000..e50ec1d --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/components/built-in/rich-text.md @@ -0,0 +1,247 @@ +# rich-text 组件示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/component/rich-text.html + +## 概述 + +`rich-text` 是富文本组件,用于显示富文本内容。 + +## 基础用法 + +```vue + + + +``` + +## 完整示例 + +### 示例 1: 显示 HTML 内容 + +```vue + + + +``` + +### 示例 2: 显示网络 HTML + +```vue + + + +``` + +### 示例 3: 使用对象数组 + +```vue + + + +``` + +### 示例 4: 混合使用 + +```vue + + + +``` + +### 示例 5: 文章详情页 + +```vue + + + + + +``` + +## 属性说明 + +| 属性名 | 类型 | 默认值 | 说明 | +|--------|------|--------|------| +| nodes | String/Array | - | 节点列表/HTML String | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. `nodes` 可以是 HTML 字符串或对象数组 +2. 不同平台支持的 HTML 标签可能不同 +3. 建议使用对象数组格式以获得更好的兼容性 +4. 图片需要配置合法域名 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/component/rich-text.html diff --git a/.agents/bak-skills/uniappx-project/examples/components/built-in/scroll-view.md b/.agents/bak-skills/uniappx-project/examples/components/built-in/scroll-view.md new file mode 100644 index 0000000..ec716b1 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/components/built-in/scroll-view.md @@ -0,0 +1,337 @@ +# scroll-view 组件示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/component/scroll-view.html + +## 概述 + +`scroll-view` 是可滚动视图容器组件,用于实现可滚动的区域。 + +## 基础用法 + +```vue + + + + + +``` + +## 完整示例 + +### 示例 1: 垂直滚动 + +```vue + + + + + +``` + +### 示例 2: 水平滚动 + +```vue + + + + + +``` + +### 示例 3: 下拉刷新 + +```vue + + + +``` + +### 示例 4: 上拉加载 + +```vue + + + +``` + +### 示例 5: 滚动到指定位置 + +```vue + + + +``` + +## 属性说明 + +| 属性名 | 类型 | 默认值 | 说明 | +|--------|------|--------|------| +| scroll-x | Boolean | false | 允许横向滚动 | +| scroll-y | Boolean | false | 允许纵向滚动 | +| scroll-top | Number | - | 设置竖向滚动条位置 | +| scroll-left | Number | - | 设置横向滚动条位置 | +| refresher-enabled | Boolean | false | 开启自定义下拉刷新 | +| refresher-triggered | Boolean | false | 设置当前下拉刷新状态 | +| lower-threshold | Number | 50 | 距底部/右边多远时触发 scrolltolower 事件 | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. 使用 `scroll-y` 时必须设置固定高度 +2. 使用 `scroll-x` 时内容需要设置 `white-space: nowrap` +3. 下拉刷新需要设置 `refresher-enabled` 和 `refresher-triggered` +4. 上拉加载通过 `@scrolltolower` 事件实现 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/component/scroll-view.html diff --git a/.agents/bak-skills/uniappx-project/examples/components/built-in/slider.md b/.agents/bak-skills/uniappx-project/examples/components/built-in/slider.md new file mode 100644 index 0000000..e3255e1 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/components/built-in/slider.md @@ -0,0 +1,262 @@ +# slider 组件示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/component/slider.html + +## 概述 + +`slider` 是滑动选择器组件,用于选择数值。 + +## 基础用法 + +```vue + + + +``` + +## 完整示例 + +### 示例 1: 基本滑动条 + +```vue + + + +``` + +### 示例 2: 设置范围 + +```vue + + + +``` + +### 示例 3: 音量控制 + +```vue + + + + + +``` + +### 示例 4: 亮度控制 + +```vue + + + +``` + +### 示例 5: 价格区间选择 + +```vue + + + +``` + +## 属性说明 + +| 属性名 | 类型 | 默认值 | 说明 | +|--------|------|--------|------| +| min | Number | 0 | 最小值 | +| max | Number | 100 | 最大值 | +| step | Number | 1 | 步长,取值必须大于 0,并且可被(max - min)整除 | +| value | Number | 0 | 当前值 | +| activeColor | String | #007aff | 已选择的颜色 | +| backgroundColor | String | #ebebeb | 背景条的颜色 | +| block-size | Number | 28 | 滑块的大小,取值范围为 12 - 28 | +| block-color | String | #ffffff | 滑块的颜色 | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. `value` 必须在 `min` 和 `max` 之间 +2. `step` 必须能被 `(max - min)` 整除 +3. 可以通过 `@change` 事件监听值的变化 +4. 适合用于音量、亮度、价格区间等场景 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/component/slider.html diff --git a/.agents/bak-skills/uniappx-project/examples/components/built-in/swiper.md b/.agents/bak-skills/uniappx-project/examples/components/built-in/swiper.md new file mode 100644 index 0000000..6e48b06 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/components/built-in/swiper.md @@ -0,0 +1,294 @@ +# swiper 组件示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/component/swiper.html + +## 概述 + +`swiper` 是滑块视图容器组件,常用于轮播图。 + +## 基础用法 + +```vue + + + +``` + +## 完整示例 + +### 示例 1: 基础轮播图 + +```vue + + + + + +``` + +### 示例 2: 自定义指示点 + +```vue + + + +``` + +### 示例 3: 垂直滑动 + +```vue + + + + + +``` + +### 示例 4: 切换事件 + +```vue + + + +``` + +### 示例 5: 图片轮播 + +```vue + + + + + +``` + +## 属性说明 + +| 属性名 | 类型 | 默认值 | 说明 | +|--------|------|--------|------| +| indicator-dots | Boolean | false | 是否显示面板指示点 | +| indicator-color | String | rgba(0, 0, 0, 0.3) | 指示点颜色 | +| indicator-active-color | String | #000000 | 当前选中的指示点颜色 | +| autoplay | Boolean | false | 是否自动切换 | +| interval | Number | 5000 | 自动切换时间间隔 | +| duration | Number | 500 | 滑动动画时长 | +| circular | Boolean | false | 是否采用衔接滑动 | +| vertical | Boolean | false | 滑动方向是否为纵向 | +| current | Number | 0 | 当前所在滑块的 index | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. 必须设置固定高度才能正常显示 +2. `swiper-item` 内只能放置一个根元素 +3. `circular` 设置为 true 时可以实现循环轮播 +4. 图片轮播建议使用 `mode="aspectFill"` 保持比例 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/component/swiper.html diff --git a/.agents/bak-skills/uniappx-project/examples/components/built-in/switch.md b/.agents/bak-skills/uniappx-project/examples/components/built-in/switch.md new file mode 100644 index 0000000..0ca4a1a --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/components/built-in/switch.md @@ -0,0 +1,277 @@ +# switch 组件示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/component/switch.html + +## 概述 + +`switch` 是开关选择器组件,用于两种状态的切换。 + +## 基础用法 + +```vue + + + +``` + +## 完整示例 + +### 示例 1: 基本开关 + +```vue + + + + + +``` + +### 示例 2: 自定义颜色 + +```vue + + + +``` + +### 示例 3: 禁用状态 + +```vue + + + +``` + +### 示例 4: 设置项列表 + +```vue + + + + + +``` + +## 属性说明 + +| 属性名 | 类型 | 默认值 | 说明 | +|--------|------|--------|------| +| checked | Boolean | false | 是否选中 | +| disabled | Boolean | false | 是否禁用 | +| type | String | switch | 样式类型,可选值:switch、checkbox | +| color | String | #007aff | switch 的颜色 | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. `checked` 属性控制开关状态 +2. `@change` 事件返回 `e.detail.value` 为布尔值 +3. 可以通过 `color` 自定义开关颜色 +4. `disabled` 为 true 时开关不可操作 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/component/switch.html diff --git a/.agents/bak-skills/uniappx-project/examples/components/built-in/text.md b/.agents/bak-skills/uniappx-project/examples/components/built-in/text.md new file mode 100644 index 0000000..c9cf1f5 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/components/built-in/text.md @@ -0,0 +1,151 @@ +# text 组件示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/component/text.html + +## 概述 + +`text` 是文本组件,用于显示文本内容。 + +## 基础用法 + +```vue + +``` + +## 完整示例 + +### 示例 1: 基本文本 + +```vue + + + +``` + +### 示例 2: 文本嵌套 + +```vue + + + +``` + +### 示例 3: 文本选择 + +```vue + +``` + +### 示例 4: 文本换行 + +```vue + + + +``` + +### 示例 5: 文本样式 + +```vue + + + +``` + +## 属性说明 + +| 属性名 | 类型 | 默认值 | 说明 | +|--------|------|--------|------| +| selectable | Boolean | false | 文本是否可选 | +| user-select | Boolean | false | 文本是否可选(H5) | +| space | String | - | 显示连续空格 | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. `text` 组件内只能嵌套 `text` 组件 +2. `selectable` 属性用于控制文本是否可选择 +3. 文本样式通过 CSS 控制 +4. 建议使用 `text` 组件而不是直接在 `view` 中写文本 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/component/text.html diff --git a/.agents/bak-skills/uniappx-project/examples/components/built-in/textarea.md b/.agents/bak-skills/uniappx-project/examples/components/built-in/textarea.md new file mode 100644 index 0000000..ae6ab6c --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/components/built-in/textarea.md @@ -0,0 +1,261 @@ +# textarea 组件示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/component/textarea.html + +## 概述 + +`textarea` 是多行输入框组件,用于输入多行文本。 + +## 基础用法 + +```vue + + + +``` + +## 完整示例 + +### 示例 1: 基本多行输入 + +```vue + + + +``` + +### 示例 2: 限制输入长度 + +```vue + + + + + +``` + +### 示例 3: 自动调整高度 + +```vue + + + +``` + +### 示例 4: 固定高度 + +```vue + + + + + +``` + +### 示例 5: 表单验证 + +```vue + + + + + +``` + +## 属性说明 + +| 属性名 | 类型 | 默认值 | 说明 | +|--------|------|--------|------| +| value | String | - | 输入框的内容 | +| placeholder | String | - | 输入框为空时占位符 | +| placeholder-style | String | - | 指定 placeholder 的样式 | +| disabled | Boolean | false | 是否禁用 | +| maxlength | Number | 140 | 最大输入长度,-1 表示不限制 | +| auto-focus | Boolean | false | 是否自动聚焦 | +| focus | Boolean | false | 获取焦点 | +| auto-height | Boolean | false | 是否自动增高 | +| fixed | Boolean | false | 如果 textarea 是在一个 position:fixed 的区域,需要显示指定属性 fixed 为 true | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. `v-model` 是双向绑定的推荐方式 +2. `maxlength` 设置为 -1 时不限制最大长度 +3. `auto-height` 可以让输入框随内容自动调整高度 +4. 建议使用 `@input` 事件监听输入变化 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/component/textarea.html +- **单行输入**: https://doc.dcloud.net.cn/uni-app-x/component/input.html diff --git a/.agents/bak-skills/uniappx-project/examples/components/built-in/video.md b/.agents/bak-skills/uniappx-project/examples/components/built-in/video.md new file mode 100644 index 0000000..4b9b50f --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/components/built-in/video.md @@ -0,0 +1,291 @@ +# video 组件示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/component/video.html + +## 概述 + +`video` 是视频播放组件,用于播放视频内容。 + +## 基础用法 + +```vue + +``` + +## 完整示例 + +### 示例 1: 基本视频播放 + +```vue + + + + + +``` + +### 示例 2: 视频播放控制 + +```vue + + + +``` + +### 示例 3: 视频列表 + +```vue + + + + + +``` + +### 示例 4: 全屏播放 + +```vue + + + +``` + +### 示例 5: 视频弹幕 + +```vue + + + +``` + +## 属性说明 + +| 属性名 | 类型 | 默认值 | 说明 | +|--------|------|--------|------| +| src | String | - | 要播放视频的资源地址 | +| controls | Boolean | true | 是否显示默认播放控件 | +| autoplay | Boolean | false | 是否自动播放 | +| loop | Boolean | false | 是否循环播放 | +| muted | Boolean | false | 是否静音播放 | +| poster | String | - | 视频封面的图片网络资源地址 | +| show-fullscreen-btn | Boolean | true | 是否显示全屏按钮 | +| enable-play-gesture | Boolean | false | 是否开启播放手势 | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. 视频地址需要配置合法域名 +2. `autoplay` 在某些平台可能不生效 +3. 建议设置 `poster` 作为视频封面 +4. 可以通过事件监听播放状态 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/component/video.html +- **选择视频**: https://doc.dcloud.net.cn/uni-app-x/api/media/video.html#choosevideo diff --git a/.agents/bak-skills/uniappx-project/examples/components/built-in/view.md b/.agents/bak-skills/uniappx-project/examples/components/built-in/view.md new file mode 100644 index 0000000..2fcb44f --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/components/built-in/view.md @@ -0,0 +1,407 @@ +# view 组件示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/component/view.html + +## 概述 + +`view` 是视图容器组件,类似于 HTML 中的 `div`,用于包裹各种元素内容。 + +## 基础用法 + +### 基本视图容器 + +```vue + + + +``` + +## 完整示例 + +### 示例 1: Flex 布局 - 横向布局 + +```vue + + + +``` + +### 示例 2: Flex 布局 - 纵向布局 + +```vue + + + +``` + +### 示例 3: 点击态效果 + +```vue + + + + + +``` + +### 示例 4: 阻止点击态冒泡 + +```vue + + + + + +``` + +### 示例 5: 嵌套视图 + +```vue + + + +``` + +### 示例 6: 条件渲染 + +```vue + + + + + +``` + +### 示例 7: 列表渲染 + +```vue + + + + + +``` + +## 属性说明 + +| 属性名 | 类型 | 默认值 | 说明 | +|--------|------|--------|------| +| hover-class | String | none | 指定按下去的样式类 | +| hover-stop-propagation | Boolean | false | 指定是否阻止本节点的祖先节点出现点击态 | +| hover-start-time | Number | 50 | 按住后多久出现点击态,单位毫秒 | +| hover-stay-time | Number | 400 | 手指松开后点击态保留时间,单位毫秒 | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. `view` 组件本身不显示任何可视化元素,主要用于包裹其他组件 +2. 可以使用 CSS 样式控制 `view` 的显示效果 +3. 支持 Flex 布局,常用于页面布局 +4. `hover-class` 属性用于设置点击态效果 +5. `hover-stop-propagation` 在某些平台可能不支持 + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/component/view.html +- **Flex 布局**: https://uniapp.dcloud.net.cn/tutorial/css-flex.html diff --git a/.agents/bak-skills/uniappx-project/examples/components/built-in/web-view.md b/.agents/bak-skills/uniappx-project/examples/components/built-in/web-view.md new file mode 100644 index 0000000..e1f989e --- /dev/null +++ b/.agents/bak-skills/uniappx-project/examples/components/built-in/web-view.md @@ -0,0 +1,196 @@ +# web-view 组件示例 + +## 官方文档 + +参考官方文档:https://doc.dcloud.net.cn/uni-app-x/component/web-view.html + +## 概述 + +`web-view` 是网页视图组件,用于在页面中嵌入网页。 + +## 基础用法 + +```vue + +``` + +## 完整示例 + +### 示例 1: 基本网页显示 + +```vue + + + + + +``` + +### 示例 2: 动态加载网页 + +```vue + + + +``` + +### 示例 3: 从参数加载网页 + +```vue + + + +``` + +### 示例 4: 网页与小程序通信 + +```vue + + + +``` + +### 示例 5: 加载本地 HTML + +```vue + + + +``` + +## 属性说明 + +| 属性名 | 类型 | 默认值 | 说明 | +|--------|------|--------|------| +| src | String | - | webview 指向网页的链接 | + +## 事件说明 + +| 事件名 | 说明 | 返回值 | +|--------|------|--------| +| @message | 网页向小程序 postMessage 时触发 | e.detail.data 包含网页传递的数据 | + +## 平台兼容性 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +## 注意事项 + +1. `src` 必须是 HTTPS 协议(H5 除外) +2. 需要在 `manifest.json` 中配置业务域名 +3. 网页可以通过 `wx.miniProgram.postMessage` 向小程序发送消息 +4. 建议使用全屏显示 web-view + +## 参考资源 + +- **官方文档**: https://doc.dcloud.net.cn/uni-app-x/component/web-view.html +- **配置业务域名**: https://uniapp.dcloud.net.cn/tutorial/app-webview.html diff --git a/.agents/bak-skills/uniappx-project/references/api/README.md b/.agents/bak-skills/uniappx-project/references/api/README.md new file mode 100644 index 0000000..9972240 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/references/api/README.md @@ -0,0 +1,174 @@ +# UniApp API 参考文档 + +本文档提供 uni-app 所有 API 的完整参考信息。 + +## API 分类索引 + +### 1. 网络请求(Network) + +- [uni.request](./network.md#uni-request) - 发起网络请求 +- [uni.uploadFile](./network.md#uni-uploadfile) - 上传文件 +- [uni.downloadFile](./network.md#uni-downloadfile) - 下载文件 +- [uni.connectSocket](./network.md#uni-connectsocket) - 创建 WebSocket 连接 +- [uni.onSocketOpen](./network.md#uni-onsocketopen) - 监听 WebSocket 连接打开事件 +- [uni.onSocketError](./network.md#uni-onsocketerror) - 监听 WebSocket 错误事件 +- [uni.sendSocketMessage](./network.md#uni-sendsocketmessage) - 通过 WebSocket 发送数据 +- [uni.onSocketMessage](./network.md#uni-onsocketmessage) - 监听 WebSocket 接受到服务器的消息事件 +- [uni.closeSocket](./network.md#uni-closesocket) - 关闭 WebSocket 连接 +- [uni.onSocketClose](./network.md#uni-onsocketclose) - 监听 WebSocket 连接关闭事件 + +### 2. 数据存储(Storage) + +- [uni.setStorage](./storage.md#uni-setstorage) - 将数据存储在本地缓存中指定的 key 中 +- [uni.setStorageSync](./storage.md#uni-setstoragesync) - 同步将数据存储在本地缓存中指定的 key 中 +- [uni.getStorage](./storage.md#uni-getstorage) - 从本地缓存中异步获取指定 key 的内容 +- [uni.getStorageSync](./storage.md#uni-getstoragesync) - 从本地缓存中同步获取指定 key 的内容 +- [uni.getStorageInfo](./storage.md#uni-getstorageinfo) - 异步获取当前 storage 的相关信息 +- [uni.getStorageInfoSync](./storage.md#uni-getstorageinfosync) - 同步获取当前 storage 的相关信息 +- [uni.removeStorage](./storage.md#uni-removestorage) - 从本地缓存中异步移除指定 key +- [uni.removeStorageSync](./storage.md#uni-removestoragesync) - 从本地缓存中同步移除指定 key +- [uni.clearStorage](./storage.md#uni-clearstorage) - 清理本地数据缓存 +- [uni.clearStorageSync](./storage.md#uni-clearstoragesync) - 同步清理本地数据缓存 + +### 3. 设备信息(Device) + +- [uni.getSystemInfo](./device.md#uni-getsysteminfo) - 获取系统信息 +- [uni.getSystemInfoSync](./device.md#uni-getsysteminfosync) - 同步获取系统信息 +- [uni.getNetworkType](./device.md#uni-getnetworktype) - 获取网络类型 +- [uni.onNetworkStatusChange](./device.md#uni-onnetworkstatuschange) - 监听网络状态变化 +- [uni.getBatteryInfo](./device.md#uni-getbatteryinfo) - 获取设备电量信息 +- [uni.getBatteryInfoSync](./device.md#uni-getbatteryinfosync) - 同步获取设备电量信息 +- [uni.setScreenBrightness](./device.md#uni-setscreenbrightness) - 设置屏幕亮度 +- [uni.getScreenBrightness](./device.md#uni-getscreenbrightness) - 获取屏幕亮度 +- [uni.setKeepScreenOn](./device.md#uni-setkeepscreenon) - 设置是否保持屏幕常亮 + +### 4. 界面交互(UI) + +- [uni.showToast](./ui.md#uni-showtoast) - 显示消息提示框 +- [uni.showLoading](./ui.md#uni-showloading) - 显示加载提示框 +- [uni.hideToast](./ui.md#uni-hidetoast) - 隐藏消息提示框 +- [uni.hideLoading](./ui.md#uni-hideloading) - 隐藏加载提示框 +- [uni.showModal](./ui.md#uni-showmodal) - 显示模态弹窗 +- [uni.showActionSheet](./ui.md#uni-showactionsheet) - 显示操作菜单 +- [uni.setNavigationBarTitle](./ui.md#uni-setnavigationbartitle) - 设置当前页面标题 +- [uni.setNavigationBarColor](./ui.md#uni-setnavigationbarcolor) - 设置页面导航栏颜色 +- [uni.showNavigationBarLoading](./ui.md#uni-shownavigationbarloading) - 显示导航栏加载动画 +- [uni.hideNavigationBarLoading](./ui.md#uni-hidenavigationbarloading) - 隐藏导航栏加载动画 +- [uni.setTabBarBadge](./ui.md#uni-settabbarbadge) - 为 tabBar 某一项的右上角添加文本 +- [uni.removeTabBarBadge](./ui.md#uni-removetabbarbadge) - 移除 tabBar 某一项右上角的文本 +- [uni.showTabBarRedDot](./ui.md#uni-showtabbarreddot) - 显示 tabBar 某一项的右上角的红点 +- [uni.hideTabBarRedDot](./ui.md#uni-hidetabbarreddot) - 隐藏 tabBar 某一项的右上角的红点 +- [uni.setTabBarStyle](./ui.md#uni-settabbarstyle) - 动态设置 tabBar 的整体样式 +- [uni.setTabBarItem](./ui.md#uni-settabbaritem) - 动态设置 tabBar 某一项的内容 + +### 5. 位置服务(Location) + +- [uni.getLocation](./location.md#uni-getlocation) - 获取当前地理位置 +- [uni.openLocation](./location.md#uni-openlocation) - 使用微信内置地图查看位置 +- [uni.chooseLocation](./location.md#uni-chooselocation) - 打开地图选择位置 + +### 6. 媒体处理(Media) + +- [uni.chooseImage](./media.md#uni-chooseimage) - 从本地相册选择图片或使用相机拍照 +- [uni.previewImage](./media.md#uni-previewimage) - 预览图片 +- [uni.getImageInfo](./media.md#uni-getimageinfo) - 获取图片信息 +- [uni.saveImageToPhotosAlbum](./media.md#uni-saveimagetophotosalbum) - 保存图片到系统相册 +- [uni.chooseVideo](./media.md#uni-choosevideo) - 从本地相册选择视频或使用相机拍摄视频 +- [uni.saveVideoToPhotosAlbum](./media.md#uni-savevideotophotosalbum) - 保存视频到系统相册 +- [uni.chooseMedia](./media.md#uni-choosemedia) - 拍摄或从手机相册中选择图片或视频 +- [uni.chooseFile](./media.md#uni-choosefile) - 从本地选择文件 + +### 7. 页面路由(Navigation) + +- [uni.navigateTo](./navigation.md#uni-navigateto) - 保留当前页面,跳转到应用内的某个页面 +- [uni.redirectTo](./navigation.md#uni-redirectto) - 关闭当前页面,跳转到应用内的某个页面 +- [uni.reLaunch](./navigation.md#uni-relaunch) - 关闭所有页面,打开到应用内的某个页面 +- [uni.switchTab](./navigation.md#uni-switchtab) - 跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面 +- [uni.navigateBack](./navigation.md#uni-navigateback) - 关闭当前页面,返回上一页面或多级页面 + +### 8. 文件操作(File) + +- [uni.saveFile](./file.md#uni-savefile) - 保存文件到本地 +- [uni.getFileInfo](./file.md#uni-getfileinfo) - 获取文件信息 +- [uni.getSavedFileList](./file.md#uni-getsavedfilelist) - 获取已保存的文件列表 +- [uni.getSavedFileInfo](./file.md#uni-getsavedfileinfo) - 获取已保存的文件信息 +- [uni.removeSavedFile](./file.md#uni-removesavedfile) - 删除已保存的文件 + +### 9. 支付(Payment) + +- [uni.requestPayment](./payment.md#uni-requestpayment) - 发起支付 + +### 10. 分享(Share) + +- [uni.share](./share.md#uni-share) - 分享内容 + +### 11. 其他 API(Other) + +- [uni.canIUse](./other.md#uni-caniuse) - 判断应用的版本是否支持某个 API +- [uni.getProvider](./other.md#uni-getprovider) - 获取服务供应商 +- [uni.login](./other.md#uni-login) - 登录 +- [uni.getUserInfo](./other.md#uni-getuserinfo) - 获取用户信息 +- [uni.checkSession](./other.md#uni-checksession) - 检查登录状态是否过期 +- [uni.authorize](./other.md#uni-authorize) - 提前向用户发起授权请求 +- [uni.openSetting](./other.md#uni-opensetting) - 调起客户端小程序设置页面 +- [uni.getSetting](./other.md#uni-getsetting) - 获取用户的当前设置 + +## API 调用规范 + +### 回调函数 + +uni-app API 支持两种调用方式: + +1. **回调函数方式**: +```javascript +uni.request({ + url: 'https://api.example.com/data', + success: (res) => { + console.log(res.data) + }, + fail: (err) => { + console.error(err) + } +}) +``` + +2. **Promise 方式**(部分 API 支持): +```javascript +uni.request({ + url: 'https://api.example.com/data' +}).then(res => { + console.log(res.data) +}).catch(err => { + console.error(err) +}) +``` + +### 同步 API + +部分 API 提供同步版本(以 Sync 结尾),如: +- `uni.getStorageSync()` - 同步获取存储 +- `uni.setStorageSync()` - 同步设置存储 +- `uni.getSystemInfoSync()` - 同步获取系统信息 + +### 平台兼容性 + +每个 API 的详细平台支持情况见对应 API 的文档。使用前请检查平台兼容性,必要时使用条件编译: + +```javascript +// #ifdef MP-WEIXIN +uni.requestPayment({ + // 微信小程序支付 +}) +// #endif + +// #ifdef APP-PLUS +uni.requestPayment({ + // App 支付 +}) +// #endif +``` + +## 参考资源 + +- [uni-app API 文档](https://doc.dcloud.net.cn/uni-app-x/api/) +- [uni-app 条件编译](https://uniapp.dcloud.net.cn/tutorial/platform.html) diff --git a/.agents/bak-skills/uniappx-project/references/api/device.md b/.agents/bak-skills/uniappx-project/references/api/device.md new file mode 100644 index 0000000..d09d074 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/references/api/device.md @@ -0,0 +1,63 @@ +# 设备信息 API + +## 概述 + +设备信息 API 用于获取设备系统信息、网络状态等。 + +## API 列表 + +### uni.getSystemInfo + +获取系统信息。 + +**详细文档**:https://doc.dcloud.net.cn/uni-app-x/api/system/system-info.html#getsysteminfo + +**返回值**: +- `brand` - 手机品牌 +- `model` - 手机型号 +- `pixelRatio` - 设备像素比 +- `screenWidth` - 屏幕宽度 +- `screenHeight` - 屏幕高度 +- `windowWidth` - 可使用窗口宽度 +- `windowHeight` - 可使用窗口高度 +- `statusBarHeight` - 状态栏的高度 +- `language` - 应用设置的语言 +- `version` - 版本号 +- `platform` - 平台 + +**示例**: +```javascript +uni.getSystemInfo({ + success: (res) => { + console.log('屏幕宽度', res.screenWidth) + console.log('屏幕高度', res.screenHeight) + console.log('状态栏高度', res.statusBarHeight) + } +}) +``` + +### uni.getSystemInfoSync + +同步获取系统信息。 + +**详细文档**:https://doc.dcloud.net.cn/uni-app-x/api/system/system-info.html#getsysteminfosync + +### uni.getNetworkType + +获取网络类型。 + +**详细文档**:https://doc.dcloud.net.cn/uni-app-x/api/system/network.html#getnetworktype + +**返回值**: +- `networkType` - 网络类型(wifi、2g、3g、4g、unknown、none) + +### uni.onNetworkStatusChange + +监听网络状态变化。 + +**详细文档**:https://doc.dcloud.net.cn/uni-app-x/api/system/network.html#onnetworkstatuschange + +## 参考资源 + +- [uni-app 系统信息文档](https://doc.dcloud.net.cn/uni-app-x/api/system/system-info.html) +- [uni-app 网络状态文档](https://doc.dcloud.net.cn/uni-app-x/api/system/network.html) diff --git a/.agents/bak-skills/uniappx-project/references/api/file.md b/.agents/bak-skills/uniappx-project/references/api/file.md new file mode 100644 index 0000000..cdb054b --- /dev/null +++ b/.agents/bak-skills/uniappx-project/references/api/file.md @@ -0,0 +1,35 @@ +# 文件操作 API + +## 概述 + +文件操作 API 用于保存文件、获取文件信息等。 + +## API 列表 + +### uni.saveFile + +保存文件到本地。 + +**详细文档**:https://doc.dcloud.net.cn/uni-app-x/api/file/file.html#savefile + +### uni.getFileInfo + +获取文件信息。 + +**详细文档**:https://doc.dcloud.net.cn/uni-app-x/api/file/file.html#getfileinfo + +### uni.getSavedFileList + +获取已保存的文件列表。 + +**详细文档**:https://doc.dcloud.net.cn/uni-app-x/api/file/file.html#getsavedfilelist + +### uni.removeSavedFile + +删除已保存的文件。 + +**详细文档**:https://doc.dcloud.net.cn/uni-app-x/api/file/file.html#removesavedfile + +## 参考资源 + +- [uni-app 文件文档](https://doc.dcloud.net.cn/uni-app-x/api/file/file.html) diff --git a/.agents/bak-skills/uniappx-project/references/api/location.md b/.agents/bak-skills/uniappx-project/references/api/location.md new file mode 100644 index 0000000..7dbaef0 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/references/api/location.md @@ -0,0 +1,59 @@ +# 位置服务 API + +## 概述 + +位置服务 API 用于获取地理位置、打开地图等。 + +## API 列表 + +### uni.getLocation + +获取当前地理位置。 + +**详细文档**:https://doc.dcloud.net.cn/uni-app-x/api/location/location.html#getlocation + +**参数**: +- `type` (String) - 默认为 wgs84 返回 gps 坐标,gcj02 返回可用于 uni.openLocation 的坐标 +- `altitude` (Boolean) - 传入 true 会返回高度信息 +- `geocode` (Boolean) - 默认 false,传入 true 会解析地址信息 + +**返回值**: +- `latitude` - 纬度 +- `longitude` - 经度 +- `speed` - 速度 +- `accuracy` - 位置的精确度 +- `altitude` - 高度 +- `verticalAccuracy` - 垂直精度 +- `horizontalAccuracy` - 水平精度 + +**示例**: +```javascript +uni.getLocation({ + type: 'gcj02', + success: (res) => { + console.log('当前位置', res.latitude, res.longitude) + } +}) +``` + +### uni.openLocation + +使用微信内置地图查看位置。 + +**详细文档**:https://doc.dcloud.net.cn/uni-app-x/api/location/open-location.html#openlocation + +**参数**: +- `latitude` (Number) - 纬度 +- `longitude` (Number) - 经度 +- `name` (String) - 位置名称 +- `address` (String) - 地址的详细说明 + +### uni.chooseLocation + +打开地图选择位置。 + +**详细文档**:https://doc.dcloud.net.cn/uni-app-x/api/location/choose-location.html#chooselocation + +## 参考资源 + +- [uni-app 位置服务文档](https://doc.dcloud.net.cn/uni-app-x/api/location/location.html) diff --git a/.agents/bak-skills/uniappx-project/references/api/media.md b/.agents/bak-skills/uniappx-project/references/api/media.md new file mode 100644 index 0000000..55ca2ea --- /dev/null +++ b/.agents/bak-skills/uniappx-project/references/api/media.md @@ -0,0 +1,67 @@ +# 媒体处理 API + +## 概述 + +媒体处理 API 用于选择图片、预览图片、选择视频等。 + +## API 列表 + +### uni.chooseImage + +从本地相册选择图片或使用相机拍照。 + +**详细文档**:https://doc.dcloud.net.cn/uni-app-x/api/media/image.html#chooseimage + +**参数**: +- `count` (Number) - 最多可以选择的图片张数,默认 9 +- `sizeType` (Array) - 所选的图片的尺寸(original、compressed) +- `sourceType` (Array) - 选择图片的来源(album、camera) + +**返回值**: +- `tempFilePaths` - 图片的本地文件路径列表 +- `tempFiles` - 图片的本地文件列表 + +**示例**: +```javascript +uni.chooseImage({ + count: 1, + sizeType: ['original', 'compressed'], + sourceType: ['album', 'camera'], + success: (res) => { + console.log('选择的图片', res.tempFilePaths) + } +}) +``` + +### uni.previewImage + +预览图片。 + +**详细文档**:https://doc.dcloud.net.cn/uni-app-x/api/media/image.html#previewimage + +**参数**: +- `urls` (Array) - 需要预览的图片 http 链接列表 +- `current` (Number) - 当前显示图片的索引 + +### uni.getImageInfo + +获取图片信息。 + +**详细文档**:https://doc.dcloud.net.cn/uni-app-x/api/media/image.html#getimageinfo + +### uni.saveImageToPhotosAlbum + +保存图片到系统相册。 + +**详细文档**:https://doc.dcloud.net.cn/uni-app-x/api/media/image.html#saveimagetophotosalbum + +### uni.chooseVideo + +从本地相册选择视频或使用相机拍摄视频。 + +**详细文档**:https://doc.dcloud.net.cn/uni-app-x/api/media/video.html#choosevideo + +## 参考资源 + +- [uni-app 图片文档](https://doc.dcloud.net.cn/uni-app-x/api/media/image.html) +- [uni-app 视频文档](https://doc.dcloud.net.cn/uni-app-x/api/media/video.html) diff --git a/.agents/bak-skills/uniappx-project/references/api/navigation.md b/.agents/bak-skills/uniappx-project/references/api/navigation.md new file mode 100644 index 0000000..1fb47a3 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/references/api/navigation.md @@ -0,0 +1,60 @@ +# 页面路由 API + +## 概述 + +页面路由 API 用于页面跳转和导航。 + +## API 列表 + +### uni.navigateTo + +保留当前页面,跳转到应用内的某个页面。 + +**详细文档**:https://doc.dcloud.net.cn/uni-app-x/api/router.html#navigateto + +**参数**: +- `url` (String) - 需要跳转的应用内非 tabBar 的页面的路径,路径后可以带参数 +- `success` (Function) - 接口调用成功的回调函数 +- `fail` (Function) - 接口调用失败的回调函数 +- `complete` (Function) - 接口调用结束的回调函数 + +**示例**: +```javascript +uni.navigateTo({ + url: '/pages/detail/detail?id=123&name=test', + success: () => { + console.log('跳转成功') + } +}) +``` + +### uni.redirectTo + +关闭当前页面,跳转到应用内的某个页面。 + +**详细文档**:https://doc.dcloud.net.cn/uni-app-x/api/router.html#redirectto + +### uni.reLaunch + +关闭所有页面,打开到应用内的某个页面。 + +**详细文档**:https://doc.dcloud.net.cn/uni-app-x/api/router.html#relaunch + +### uni.switchTab + +跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面。 + +**详细文档**:https://doc.dcloud.net.cn/uni-app-x/api/router.html#switchtab + +### uni.navigateBack + +关闭当前页面,返回上一页面或多级页面。 + +**详细文档**:https://doc.dcloud.net.cn/uni-app-x/api/router.html#navigateback + +**参数**: +- `delta` (Number) - 返回的页面数,如果 delta 大于现有页面数,则返回到首页 + +## 参考资源 + +- [uni-app 路由文档](https://doc.dcloud.net.cn/uni-app-x/api/router.html) diff --git a/.agents/bak-skills/uniappx-project/references/api/network.md b/.agents/bak-skills/uniappx-project/references/api/network.md new file mode 100644 index 0000000..3d00837 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/references/api/network.md @@ -0,0 +1,276 @@ +# 网络请求 API + +## uni.request + +发起网络请求。 + +### 参数 + +| 参数名 | 类型 | 必填 | 说明 | 平台差异说明 | +|--------|------|------|------|--------------| +| url | String | 是 | 开发者服务器接口地址 | - | +| data | Object/String/ArrayBuffer | 否 | 请求的参数 | - | +| header | Object | 否 | 设置请求的 header,header 中不能设置 Referer | - | +| method | String | 否 | HTTP 请求方法,默认为 GET | - | +| timeout | Number | 否 | 超时时间,单位为 ms,默认为 60000 | - | +| dataType | String | 否 | 如果设为 json,会尝试对返回的数据做一次 JSON.parse | - | +| responseType | String | 否 | 设置响应的数据类型,默认为 text | - | +| sslVerify | Boolean | 否 | 验证 ssl 证书 | App | +| withCredentials | Boolean | 否 | 跨域请求时是否携带凭证(cookies) | H5 | +| firstIpv4 | Boolean | 否 | DNS 解析时优先使用 ipv4 | App | + +### 返回值 + +| 参数名 | 类型 | 说明 | +|--------|------|------| +| data | Object/String/ArrayBuffer | 服务器返回的数据 | +| statusCode | Number | HTTP 状态码 | +| header | Object | 服务器返回的 header | +| cookies | Array | 服务器返回的 cookies | + +### 平台支持 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ✅ | + +### 示例 + +```javascript +// GET 请求 +uni.request({ + url: 'https://api.example.com/data', + method: 'GET', + data: { + id: 123 + }, + success: (res) => { + console.log(res.data) + }, + fail: (err) => { + console.error(err) + } +}) + +// POST 请求 +uni.request({ + url: 'https://api.example.com/data', + method: 'POST', + data: { + name: 'John', + age: 30 + }, + header: { + 'Content-Type': 'application/json' + }, + success: (res) => { + console.log(res.data) + } +}) + +// 使用 Promise +uni.request({ + url: 'https://api.example.com/data' +}).then(res => { + console.log(res.data) +}).catch(err => { + console.error(err) +}) +``` + +## uni.uploadFile + +上传文件。 + +### 参数 + +| 参数名 | 类型 | 必填 | 说明 | 平台差异说明 | +|--------|------|------|------|--------------| +| url | String | 是 | 开发者服务器 url | - | +| filePath | String | 是 | 要上传文件资源的路径 | - | +| name | String | 是 | 文件对应的 key,开发者在服务端可以通过这个 key 获取文件的二进制内容 | - | +| header | Object | 否 | HTTP 请求 Header,header 中不能设置 Referer | - | +| formData | Object | 否 | HTTP 请求中其他额外的 form data | - | +| timeout | Number | 否 | 超时时间,单位为 ms,默认为 60000 | - | + +### 返回值 + +| 参数名 | 类型 | 说明 | +|--------|------|------| +| data | String | 服务器返回的数据 | +| statusCode | Number | HTTP 状态码 | + +### 平台支持 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ❌ | + +### 示例 + +```javascript +uni.chooseImage({ + count: 1, + success: (res) => { + const tempFilePaths = res.tempFilePaths + uni.uploadFile({ + url: 'https://api.example.com/upload', + filePath: tempFilePaths[0], + name: 'file', + formData: { + 'user': 'test' + }, + success: (uploadRes) => { + console.log(uploadRes.data) + }, + fail: (err) => { + console.error(err) + } + }) + } +}) +``` + +## uni.downloadFile + +下载文件。 + +### 参数 + +| 参数名 | 类型 | 必填 | 说明 | 平台差异说明 | +|--------|------|------|------|--------------| +| url | String | 是 | 下载资源的 url | - | +| header | Object | 否 | HTTP 请求 Header,header 中不能设置 Referer | - | +| timeout | Number | 否 | 超时时间,单位为 ms,默认为 60000 | - | + +### 返回值 + +| 参数名 | 类型 | 说明 | +|--------|------|------| +| tempFilePath | String | 临时文件路径,下载后的文件会存储到一个临时文件 | +| statusCode | Number | HTTP 状态码 | + +### 平台支持 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ❌ | + +### 示例 + +```javascript +uni.downloadFile({ + url: 'https://example.com/file.pdf', + success: (res) => { + if (res.statusCode === 200) { + console.log('下载成功', res.tempFilePath) + // 可以调用 uni.openDocument 打开文件 + uni.openDocument({ + filePath: res.tempFilePath, + success: () => { + console.log('打开文档成功') + } + }) + } + }, + fail: (err) => { + console.error('下载失败', err) + } +}) +``` + +## uni.connectSocket + +创建 WebSocket 连接。 + +### 参数 + +| 参数名 | 类型 | 必填 | 说明 | 平台差异说明 | +|--------|------|------|------|--------------| +| url | String | 是 | 服务器接口地址,必须是 wss 协议,且域名必须是后台配置的合法域名 | - | +| header | Object | 否 | HTTP Header,header 中不能设置 Referer | - | +| protocols | Array | 否 | 子协议数组 | H5 | +| method | String | 否 | 请求方法 | App | + +### 平台支持 + +| 平台 | 支持情况 | +|------|---------| +| H5 | ✅ | +| 微信小程序 | ✅ | +| 支付宝小程序 | ✅ | +| 百度小程序 | ✅ | +| 字节跳动小程序 | ✅ | +| QQ 小程序 | ✅ | +| 快手小程序 | ✅ | +| App | ✅ | +| 快应用 | ❌ | + +### 示例 + +```javascript +// 创建 WebSocket 连接 +uni.connectSocket({ + url: 'wss://example.com/websocket', + success: () => { + console.log('连接成功') + } +}) + +// 监听 WebSocket 连接打开事件 +uni.onSocketOpen((res) => { + console.log('WebSocket 连接已打开') +}) + +// 监听 WebSocket 错误事件 +uni.onSocketError((res) => { + console.error('WebSocket 错误', res) +}) + +// 发送数据 +uni.sendSocketMessage({ + data: JSON.stringify({ + type: 'message', + content: 'Hello' + }) +}) + +// 监听接收消息 +uni.onSocketMessage((res) => { + console.log('收到消息', res.data) +}) + +// 关闭连接 +uni.closeSocket() +``` + +## 参考资源 + +- [uni-app 网络请求文档](https://doc.dcloud.net.cn/uni-app-x/api/network/request.html) +- [uni-app 文件上传文档](https://doc.dcloud.net.cn/uni-app-x/api/network/upload.html) +- [uni-app 文件下载文档](https://doc.dcloud.net.cn/uni-app-x/api/network/download.html) +- [uni-app WebSocket 文档](https://doc.dcloud.net.cn/uni-app-x/api/network/websocket.html) diff --git a/.agents/bak-skills/uniappx-project/references/api/other.md b/.agents/bak-skills/uniappx-project/references/api/other.md new file mode 100644 index 0000000..5b1223e --- /dev/null +++ b/.agents/bak-skills/uniappx-project/references/api/other.md @@ -0,0 +1,58 @@ +# 其他 API + +## 概述 + +其他 API 包括工具类 API、登录 API 等。 + +## API 列表 + +### uni.canIUse + +判断应用的版本是否支持某个 API。 + +**详细文档**:https://doc.dcloud.net.cn/uni-app-x/api/system/info.html#caniuse + +**示例**: +```javascript +if (uni.canIUse('getSystemInfo')) { + uni.getSystemInfo({ + success: (res) => { + console.log(res) + } + }) +} +``` + +### uni.login + +登录。 + +**详细文档**:https://doc.dcloud.net.cn/uni-app-x/api/login/login.html#login + +### uni.getUserInfo + +获取用户信息。 + +**详细文档**:https://doc.dcloud.net.cn/uni-app-x/api/login/login.html#getuserinfo + +### uni.authorize + +提前向用户发起授权请求。 + +**详细文档**:https://doc.dcloud.net.cn/uni-app-x/api/authorize.html#authorize + +### uni.openSetting + +调起客户端小程序设置页面。 + +**详细文档**:https://doc.dcloud.net.cn/uni-app-x/api/setting/open-setting.html#opensetting + +### uni.getSetting + +获取用户的当前设置。 + +**详细文档**:https://doc.dcloud.net.cn/uni-app-x/api/setting/get-setting.html#getsetting + +## 参考资源 + +- [uni-app API 文档](https://doc.dcloud.net.cn/uni-app-x/api/) diff --git a/.agents/bak-skills/uniappx-project/references/api/payment.md b/.agents/bak-skills/uniappx-project/references/api/payment.md new file mode 100644 index 0000000..94706da --- /dev/null +++ b/.agents/bak-skills/uniappx-project/references/api/payment.md @@ -0,0 +1,43 @@ +# 支付 API + +## 概述 + +支付 API 用于发起支付。 + +## API 列表 + +### uni.requestPayment + +发起支付。 + +**详细文档**:https://doc.dcloud.net.cn/uni-app-x/api/payment/payment.html#requestpayment + +**参数**(微信小程序): +- `provider` (String) - 支付服务提供商(wxpay) +- `timeStamp` (String) - 时间戳 +- `nonceStr` (String) - 随机字符串 +- `package` (String) - 统一下单接口返回的 prepay_id 参数值 +- `signType` (String) - 签名算法 +- `paySign` (String) - 签名 + +**示例**: +```javascript +uni.requestPayment({ + provider: 'wxpay', + timeStamp: String(Date.now()), + nonceStr: 'nonceStr', + package: 'prepay_id=xxx', + signType: 'MD5', + paySign: 'paySign', + success: (res) => { + console.log('支付成功', res) + }, + fail: (err) => { + console.error('支付失败', err) + } +}) +``` + +## 参考资源 + +- [uni-app 支付文档](https://doc.dcloud.net.cn/uni-app-x/api/payment/payment.html) diff --git a/.agents/bak-skills/uniappx-project/references/api/share.md b/.agents/bak-skills/uniappx-project/references/api/share.md new file mode 100644 index 0000000..455afda --- /dev/null +++ b/.agents/bak-skills/uniappx-project/references/api/share.md @@ -0,0 +1,25 @@ +# 分享 API + +## 概述 + +分享 API 用于分享内容。 + +## API 列表 + +### uni.share + +分享内容。 + +**详细文档**:https://doc.dcloud.net.cn/uni-app-x/api/share/share.html#share + +**参数**: +- `provider` (String) - 分享服务提供商(weixin、sinaweibo、qq) +- `type` (Number) - 分享类型(0-图文、1-纯文字、2-纯图片、3-音乐、4-视频、5-小程序) +- `href` (String) - 分享链接 +- `title` (String) - 分享标题 +- `summary` (String) - 分享摘要 +- `imageUrl` (String) - 分享图片 + +## 参考资源 + +- [uni-app 分享文档](https://doc.dcloud.net.cn/uni-app-x/api/share/share.html) diff --git a/.agents/bak-skills/uniappx-project/references/api/storage.md b/.agents/bak-skills/uniappx-project/references/api/storage.md new file mode 100644 index 0000000..ff09649 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/references/api/storage.md @@ -0,0 +1,65 @@ +# 数据存储 API + +## 概述 + +数据存储 API 用于在本地存储和获取数据。 + +## API 列表 + +### uni.setStorage + +将数据存储在本地缓存中指定的 key 中。 + +**详细文档**:https://doc.dcloud.net.cn/uni-app-x/api/storage/storage.html#setstorage + +**参数**: +- `key` (String) - 本地缓存中指定的 key +- `data` (Any) - 需要存储的内容 +- `success` (Function) - 接口调用成功的回调函数 +- `fail` (Function) - 接口调用失败的回调函数 +- `complete` (Function) - 接口调用结束的回调函数 + +**示例**: +```javascript +uni.setStorage({ + key: 'userInfo', + data: { name: 'John', age: 30 }, + success: () => { + console.log('存储成功') + } +}) +``` + +### uni.getStorage + +从本地缓存中异步获取指定 key 的内容。 + +**详细文档**:https://doc.dcloud.net.cn/uni-app-x/api/storage/storage.html#getstorage + +### uni.removeStorage + +从本地缓存中异步移除指定 key。 + +**详细文档**:https://doc.dcloud.net.cn/uni-app-x/api/storage/storage.html#removestorage + +### uni.clearStorage + +清理本地数据缓存。 + +**详细文档**:https://doc.dcloud.net.cn/uni-app-x/api/storage/storage.html#clearstorage + +### uni.setStorageSync + +同步将数据存储在本地缓存中指定的 key 中。 + +**详细文档**:https://doc.dcloud.net.cn/uni-app-x/api/storage/storage.html#setstoragesync + +### uni.getStorageSync + +从本地缓存中同步获取指定 key 的内容。 + +**详细文档**:https://doc.dcloud.net.cn/uni-app-x/api/storage/storage.html#getstoragesync + +## 参考资源 + +- [uni-app 数据存储文档](https://doc.dcloud.net.cn/uni-app-x/api/storage/storage.html) diff --git a/.agents/bak-skills/uniappx-project/references/api/ui.md b/.agents/bak-skills/uniappx-project/references/api/ui.md new file mode 100644 index 0000000..18c760c --- /dev/null +++ b/.agents/bak-skills/uniappx-project/references/api/ui.md @@ -0,0 +1,75 @@ +# 界面交互 API + +## 概述 + +界面交互 API 用于显示提示、对话框、操作菜单等。 + +## API 列表 + +### uni.showToast + +显示消息提示框。 + +**详细文档**:https://doc.dcloud.net.cn/uni-app-x/api/ui/prompt.html#showtoast + +**参数**: +- `title` (String) - 提示的内容 +- `icon` (String) - 图标类型(success、error、loading、none) +- `image` (String) - 自定义图标的本地路径 +- `duration` (Number) - 提示的延迟时间,默认 2000 +- `mask` (Boolean) - 是否显示透明蒙层,防止触摸穿透 + +**示例**: +```javascript +uni.showToast({ + title: '操作成功', + icon: 'success', + duration: 2000 +}) +``` + +### uni.showModal + +显示模态弹窗。 + +**详细文档**:https://doc.dcloud.net.cn/uni-app-x/api/ui/prompt.html#showmodal + +**参数**: +- `title` (String) - 提示的标题 +- `content` (String) - 提示的内容 +- `showCancel` (Boolean) - 是否显示取消按钮 +- `cancelText` (String) - 取消按钮的文字 +- `confirmText` (String) - 确认按钮的文字 + +**返回值**: +- `confirm` (Boolean) - 为 true 时,表示用户点击了确定按钮 +- `cancel` (Boolean) - 为 true 时,表示用户点击了取消按钮 + +### uni.showActionSheet + +显示操作菜单。 + +**详细文档**:https://doc.dcloud.net.cn/uni-app-x/api/ui/prompt.html#showactionsheet + +### uni.showLoading + +显示加载提示框。 + +**详细文档**:https://doc.dcloud.net.cn/uni-app-x/api/ui/prompt.html#showloading + +### uni.hideLoading + +隐藏加载提示框。 + +**详细文档**:https://doc.dcloud.net.cn/uni-app-x/api/ui/prompt.html#hideloading + +### uni.setNavigationBarTitle + +设置当前页面标题。 + +**详细文档**:https://doc.dcloud.net.cn/uni-app-x/api/ui/navigation-bar.html#setnavigationbartitle + +## 参考资源 + +- [uni-app 界面交互文档](https://doc.dcloud.net.cn/uni-app-x/api/ui/prompt.html) +- [uni-app 导航栏文档](https://doc.dcloud.net.cn/uni-app-x/api/ui/navigation-bar.html) diff --git a/.agents/bak-skills/uniappx-project/references/components/README.md b/.agents/bak-skills/uniappx-project/references/components/README.md new file mode 100644 index 0000000..ddb0e54 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/references/components/README.md @@ -0,0 +1,48 @@ +# Components Index | 组件索引 + +## 官方文档 + +https://doc.dcloud.net.cn/uni-app-x/component/ + +## 内置组件列表 + +- ad +- ad-draw +- audio +- button +- camera +- canvas +- checkbox +- cover-image +- cover-view +- custom-tab-bar +- editor +- form +- icon +- image +- input +- label +- live-player +- live-pusher +- map +- match-media +- movable-area +- movable-view +- navigation-bar +- navigator +- page-meta +- picker +- picker-view +- progress +- radio +- rich-text +- scroll-view +- slider +- swiper +- switch +- text +- textarea +- unicloud-db +- video +- view +- web-view diff --git a/.agents/bak-skills/uniappx-project/references/components/built-in/ad-draw.md b/.agents/bak-skills/uniappx-project/references/components/built-in/ad-draw.md new file mode 100644 index 0000000..61d2b0e --- /dev/null +++ b/.agents/bak-skills/uniappx-project/references/components/built-in/ad-draw.md @@ -0,0 +1,32 @@ +# ad-draw + +## Instructions + +也称为Draw视频信息流广告 + +沉浸视频流广告为媒体提供了竖屏视频信息流广告样式,适合在全屏的竖屏视频中使用。支持app-nvue页面使用。 + +类抖音的竖版视频流,来电秀、直播间等全屏观看的视频。 + +### Syntax + +- 使用 ``(或 ``,当需要包裹子节点时)。 +- 遇到平台差异时,建议使用条件编译(`#ifdef / #endif`)显式处理。 + +#### Properties + +See official docs for full properties list: `https://doc.dcloud.net.cn/uni-app-x/component/ad-draw.html` + +#### Events + +See official docs for full events list: `https://doc.dcloud.net.cn/uni-app-x/component/ad-draw.html` + +#### Platform Compatibility + +See official docs for platform support table: `https://doc.dcloud.net.cn/uni-app-x/component/ad-draw.html` + +### Examples + +Examples are available in the official docs: `https://doc.dcloud.net.cn/uni-app-x/component/ad-draw.html` + +Reference: [Official Documentation](https://doc.dcloud.net.cn/uni-app-x/component/ad-draw.html) diff --git a/.agents/bak-skills/uniappx-project/references/components/built-in/ad.md b/.agents/bak-skills/uniappx-project/references/components/built-in/ad.md new file mode 100644 index 0000000..1038437 --- /dev/null +++ b/.agents/bak-skills/uniappx-project/references/components/built-in/ad.md @@ -0,0 +1,32 @@ +# ad + +## Instructions + +应用内展示的广告组件,可用于banner或信息流。 + +Banner或信息流广告展现场景非常灵活,常见的展现场景为:文章顶部,详情页面顶部,第一屏中部等。建议信息流广告不要放置在底部 + +平台差异说明 + +### Syntax + +- 使用 ``(或 ``,当需要包裹子节点时)。 +- 遇到平台差异时,建议使用条件编译(`#ifdef / #endif`)显式处理。 + +#### Properties + +See official docs for full properties list: `https://doc.dcloud.net.cn/uni-app-x/component/ad.html` + +#### Events + +See official docs for full events list: `https://doc.dcloud.net.cn/uni-app-x/component/ad.html` + +#### Platform Compatibility + +See official docs for platform support table: `https://doc.dcloud.net.cn/uni-app-x/component/ad.html` + +### Examples + +Examples are available in the official docs: `https://doc.dcloud.net.cn/uni-app-x/component/ad.html` + +Reference: [Official Documentation](https://doc.dcloud.net.cn/uni-app-x/component/ad.html) diff --git a/.agents/bak-skills/uniappx-project/references/components/built-in/audio.md b/.agents/bak-skills/uniappx-project/references/components/built-in/audio.md new file mode 100644 index 0000000..7ebe50c --- /dev/null +++ b/.agents/bak-skills/uniappx-project/references/components/built-in/audio.md @@ -0,0 +1,112 @@ +# audio + +## Instructions + +音频。 + +平台差异说明 + +注意: 微信小程序平台自基础库 1.6.0 版本开始,不再维护 audio 组件,推荐使用API方式而不是组件方式来播放音频。API见 uni.createInnerAudioContext 替代。 + +### Syntax + +- 使用 `