fml-miniprogram

WeChat mini-program challenge

Build a simple mini-program in 1 day.

Background & objectives

Today we will discover the basics of the mini-program framework. The main assignment is to build a copycat of “FML: your every day life stories”, check it out now.

Day objectives:

Exercise objectives:

See it yourself:

1. Setup

Get your development environment:

2. Mini-program configuration

The WeChat framework allows to configure five items:

Specs

The app.json file is where to start your mini-program:

Here is a section of our manual to help you to configure your MP.

Further resources:

3. Create dynamic pages

In this step you will start to use the core principles of the framework. We recommend that you read this part of the manual before you start.

Specs

Further suggestions:

4. Leancloud DB

The goal here is to fetch the data from Leancloud. You will need to use a shared cloud DB, named FML-miniprogram, and use it to inject content into the cards you created ;)

Specs

Further resources:

5. Submit a new FML

Now, it is time to create a new page which allows users to submit a FML story!

Specs

Everything is in the tutorial just follow it.

Further resources:

6. Upvote (optional)

Here is a bit of challenge: create a counter which allows users to upvote a FML story.

Specs

Further suggestions & resources:

Divide the work in three steps:

  1. Get the object ID of the FML clicked by user.
  2. Persist updated data to Leancloud DB:

    • Increment counter
    • Persist data in the DB
  3. Update local data:
    • Find the object ID in the local data storage
    • Increment counter and update local data.