当前位置:网站首页>Build a weather forecast applet using a widget
Build a weather forecast applet using a widget
2022-06-23 02:58:00 【Han Kai】
1 Introduction to applets
When we use mobile phones everyday , Checking the recent weather is a common requirement , Can you make a small program to display the weather of the last seven days ? The answer is yes , Using the external data source provided by wechat, we can easily obtain the weather forecast data publicly available on the Internet , To create our own proprietary applet .
2 Small program development method
To develop a weather forecast applet , Public API Is a must , Fortunately, there are many free API Website , We just need to register an account , Apply for test use , Free accounts are usually provided every day 50 Times of use , Being an individual user is actually enough .
obtain API after , You need to consider how to implement the functions of the applet , Our idea to solve the problem is to think about what ready-made functions of micro build can be used . External data sources are actually designed to meet the needs of data acquisition , We can obtain the interface data of the Internet through external data sources , Then the external data source is provided to the application call by defining variables .
The development steps are divided into creating external data sources 、 Create an 、 Defining variables 、 Component building 、 Preview release, etc .
3 Creating external data sources
Log in to the console , Find the data source in the menu bar on the left , Click create external data source
Enter the name and identification of the data source
After the data source is created, we need to create a new method
Enter the name and ID of the method , Enter the weather forecast API Of URL
Then click method test , See if our interface call is successful
If successful , You can click the parameter mapping
The data source will be created after the parameter is successfully entered
4 Create an applet
After the data source is defined , We can create the applet , Click the application on the left , Click blank application
Enter the app name , Type selection applet
Select Create a blank page , After successful creation, the home page is created by default
In order to display the data of the weather forecast , We need to define a variable first , Click the variable in the navigation bar
Create a model variable
Select the data source we created and the method we defined
We add a list item component to the page
Then bind the loop variable to the list item component
Then the name of the city 、 The weather 、 The date is bound to the corresponding attribute
In this way, the small program will be developed
5 Preview release
After the function is developed, it can be tested , We click the real-time preview function of the navigation bar
You can view the final effect of our applet in the browser
边栏推荐
- Solution to the problem of easycvr switching MySQL database traffic statistics cannot be displayed
- "Return index" of live broadcast E-commerce
- The commercial s2b2b e-commerce platform of aquatic industry improves the competitiveness of enterprises and creates a strong engine for industrial development
- How to prohibit copying and copying files to the local server remote desktop
- Redis source code reading (I) general overview
- C language series - Section 4 - arrays
- Call rest port to implement nailing notification
- Implementing StdevP function of Excel with PHP
- Quickly grab the red envelope cover of Tencent blue whale New Year! Slow hands!
- Understand one article: build an activity analysis system
猜你喜欢

6. template for integer and real number dichotomy
What is sitelock? What is the function?

C language series - Section 4 - arrays

8. greed

Spark broadcast variables and accumulators (cases attached)

How to store, manage and view family photos in an orderly manner?

Soft exam information system project manager_ Information system comprehensive testing and management - Senior Information System Project Manager of soft test 027

Soft exam information system project manager_ Contract Law_ Copyright_ Implementation Regulations - Senior Information System Project Manager of soft exam 030

5. concept of ruler method

Vulnhub DC-5
随机推荐
2022 opening H5 mobile page special effects
Aiot application innovation competition -- I am the master of my project, and use gn+ninja to complete the system construction (vscode Development)
Salesforce file (II) custom development fileUpload
SAP mm initial transaction code MEK1 maintenance pb00 price
Vulnhub DC-5
PNAs: power spectrum shows obvious bold resting state time process in white matter
Reinforcement learning series (III) -gym introduction and examples
Section 6: basic configuration I of spingboot
How to make keyword targeted layout based on search sources?
How to batch print serial and repeated barcode data
The performance of the new Tokio scheduler is improved by 10 times
Hypervisor Necromancy; Recover kernel protector (1)
Function recursion and iteration
How PHP uses redis
Im web demo invite end hang up error avoidance
2022-01-30: minimum good base. For a given integer n, if K (k) of n
Pytest common summary
2022-01-27: heater. Winter has come. Your task is to design a
Goframe framework (RK boot): fast implementation of CSRF verification
Summary of easy-to-use MySQL interview questions (Part 1)