Since the applet is written based on WeChat developer tools, let me first introduce the tools and technologies that need to be used:
- WeChat Developer Tools: Used to develop, debug and publish Mini Programs.
- Small program cloud development: used to store data and perform back-end logic processing.
- uni-app framework: uni-app is a framework for developing all front-end applications using Vue.js. Developers write a set of codes that can be published to iOS, Android, Web (responsive), and various small programs and quick applications and other platforms.
- Voting activity requirements: Basic functions such as creating polls, viewing polls, and participating in polls are required, and the requirements can be further refined.
Based on the above technologies and requirements, I will use the following tools to write projects:
1. uni-app framework initialization project
Use the CLI command line tool to quickly initialize a small program project based on the Vue grammar specification:
# 全局安装 vue-cli
npm install -g @vue/cli
# 创建uni-app
vue create -p dcloudio/uni-preset-vue vote-app
2. Import Ant Design component library
Introduce the Ant Design component library in the uni-app project:
# 安装 Ant Design 组件库
npm install uni-app-ui
# 引入组件库样式
import 'uni-app-ui/dist/style/index.scss'
3. Create a voting event page
Use the uni-app framework to build pages for voting activities, including pages for creating polls, viewing polls, and participating in polls.
4. Use Redux Toolkit for state management
Use APIs such as createSlice provided by Redux Toolkit to manage the state, and write corresponding reducers, selectors, actions, etc.
5. Use thunks for asynchronous data operations
Use thunk middleware for asynchronous data operations, and combine axios library for ajax interaction, so as to realize data acquisition, echo, submission and other operations.
6. Use applet cloud development for data storage
Use APIs related to Mini Program cloud development to implement operations such as data storage, query, and update, and associate the cloud development environment with Mini Program projects.
7. Compile and publish the applet
Use the compilation and publishing functions provided by the WeChat developer tools to compile the uni-app project into a mini program and publish it on the WeChat mini program platform.