Uni-app Development Expert
Paste the following prompt into your AI chat to install this skill:
Please refer to https://skillhub.cn/install/skillhub.md to install @user_1cf5565c/uniapp-expert.
About this skill
Specific Problems in uni-app Development
In uni-app full-stack development, developers often struggle with migrating Vue2 projects to Vue3 and setting up automation testing for WeChat Mini Programs. For instance, changes in v-model syntax, lifecycle hooks, and switching state management from Vuex to Pinia can introduce errors. Additionally, WeChat Mini Program automation testing involves complex environment configuration, port management, and element selector issues, which frequently lead to failures if misconfigured.
How This Skill Works
This skill offers a comprehensive solution, with core capabilities including:
- Vue2→Vue3 Migration Checklist: Covers key adjustments such as lifecycle hooks (e.g., changing
destroyedtounmounted), global APIs (e.g., replacingnew Vue()withcreateSSRApp()), and template syntax (e.g., updatingslottov-slot), ensuring a systematic migration process. - Vue3 Development Guide: Promotes the use of Composition API and
ref/reactivefor reactive data, with examples of common Composables likeuseRequestanduseLoading. - WeChat Mini Program Automation Testing Workflow: From environment setup (e.g., enabling automation port
9420), validating the compilation output directory (unpackage/dist/dev/mp-weixin), to executing tests usingWeappTestRunnerAPI methods such asnavigate,click, andinput.
Key steps involve:
1. Executing the migration checklist to systematically handle component options and API changes.
2. For automation testing, first running the cli auto command to open the port, then using scripts with screenshot and get_results to verify outcomes.
Applicable Boundaries and Considerations
This skill is primarily designed for uni-app project development, migration, and testing scenarios, but note:
- Migration Limits: Vue2 Options API remains compatible in Vue3, but complex logic is recommended to shift to Composition API; very long strings (e.g., base64 encoded data) may truncate during conversion and require manual verification.
- Testing Environment Dependencies: WeChat Mini Program automation testing requires the developer tool to have automation permissions enabled, and port 9421 must be actively listening; using incorrect selectors (e.g., tap instead of click) will cause script failures.
- Version Compatibility: uni-app page lifecycles (e.g., onUnload) remain unchanged, but Vue component lifecycles differ; third-party libraries need checks for uni_modules compatibility.
In summary, this skill focuses on practical tools and checklists to help developers efficiently address common pain points in uni-app development, but implementation should be adapted based on specific project circumstances.
Use Cases
- Migrating a uni-app project from Vue2 Options API to Vue3 Composition API requires checking lifecycle hook changes like `destroyed` to `unmounted`, while ensuring page lifecycles such as `onUnload` remain unchanged.
- Developing new uni-app pages with Vue3 Composition API involves organizing logic reuse, for example extracting asynchronous requests and loading states exceeding 50 lines into Composables like `useRequest`.
- Setting up automation testing for a WeChat Mini Program project includes enabling the automation port in the developer tools, validating the compilation output directory `unpackage/dist/dev/mp-weixin`, and writing test scripts with `navigate` and `click` operations.
- Upgrading state management in a uni-app project from Vuex to Pinia involves updating `$store` calls to the `useStore()` function in components and adapting to Vue3 reactive data practices.
Best For
- Front-end engineers responsible for migrating uni-app Vue2 projects to Vue3, needing to ensure component compatibility and correct lifecycle transitions.
- Developers using Vue3 Composition API for cross-platform apps, seeking clearer logic reuse and type inference.
- QA engineers performing WeChat Mini Program automation testing, requiring full-process implementation from environment setup to script writing.
- Full-stack developers handling uni-app state management migration from Vuex to Pinia, focusing on performance optimization and code maintainability.
Related Skills
A systematic code error fixing skill that follows a five-step workflow: Reproduce, Isolate, Understand, Fix, Verify, to help developers resolve code errors.
Supports inline SVG/HTML rendering and Mermaid code output, covering common technical diagram creation like architecture and flow diagrams.
A comprehensive browser automation guide covering navigation, interaction, multi-tab management, and data collection, tailored for domestic web ecosystems and tools like Playwright/Selenium.
This skill provides end-to-end automation for WeChat Mini Program development, covering building, debugging, previewing, testing, and publishing, with integrated code quality analysis and dependency management.