头图

The PC-side function is currently open for Mini-Bus. The method of use is to enable the template in the template center. After the template is successfully created, it will automatically increase the PC-side component library and create the required data source. This article combines the currently officially provided template and builds it yourself according to the sample program. Familiarize yourself with the usage of the official component library through the construction of templates.

create page

First of all they create a new page , we need to build it in accordance with the official template of your own home.

图片

official homepage logical analysis

The official homepage actually plays a guiding role, guiding users to click through large pictures

图片

Then we switch to the component view to analyze which components are used on the home page

图片

Its layout components use node components, which are equivalent to the divs in our html. I will draw a sample diagram to analyze the structure of the layout

图片

The first layer structure is like this, so let's add our own layout according to the first layer structure of the analysis

realize the layout

The node component is in the general category, and the way to add it is to click on the name of the component

图片

But after adding it, there is no change in the page, and the preview effect needs to be turned off.

图片

So you can see the effect

图片

Then switch to the component view, we select the slot of the node component

图片

Add two node components again in the slot

图片

In this way, the layout of the outer layer is made.

Official template content area layout analysis

We can see that the content area is divided into upper and lower parts, the upper part is the title, and the lower part is the shortcut function guide area

图片

The official template uses node components and grid components

图片

content area layout to achieve

We first select the slot of the node component in the content area

图片

Add node components in the general category

图片

Then add the deletion component in the layout category

图片

The effect after the components are built

图片

official template title area analysis

The title area is relatively simple, in fact it is to achieve the effect of the two lines of the title

The component tree is implemented through text components

图片

title area function realization

We also added two text components to the node component of the title in accordance with the official idea

图片

But the two text components are arranged horizontally, which does not match the effect of the official template. At this time, you need to set the style of the components. Generally set the layout of the parent container

The first is to set the width of the parent container, we set it to 1040PX

图片

The upper margin of the inner margin is set to 38PX, and only numbers can be input, so you need to use the style editor to manually change the word

图片

图片

For the margin, the left and right sides are both auto

图片

Then set the style of the text component, and change the layout to block layout

图片

The inner margin gives a size of 32PX

图片

If the font is set to 12PX, the color is set to blue

图片

Change the content of the text to the homepage

图片

Then we set the style of the second text component, give it a margin, each of which is 20, and set the layout to block layout

图片

The font is set to 20PX bold

图片

Modify the content of the text as a personal workbench

图片

So the title area is set

quick function guide area official template analysis

Functionally speaking, it is a shortcut operation of placing three modules. The layout is one row and four columns, so four components are placed in the template.

图片

shortcut function guide area function realization

We also follow the official idea to add four components to the node component

图片

We need to set the style on the grid component, the layout is set to flex, and the main axis alignment is justified at both ends

图片

For margins, the top and bottom are 86PX, and the left and right are auto

图片 图片

Set the width to 1040PX

图片

The style of the node component inside, the layout is set to inline block, the width is 320PX

图片

The border is set to a solid line, the color is rgb(220, 227, 243), the width is 1PX, and the rounded corners are 20PX

图片

After the outer container style is set, you need to set the content inside, and add a node component to the content inside

图片

But the type of node needs to be modified to a picture, the address of the picture has been officially provided

https://main.qcloudimg.com/raw/f28e2d68d4718c2978ae8036c8dc9990.png

图片

If the style is used, the layout is set to inline block layout, with a width of 100% and a height of 360PX

图片

Use color fill for background, fill color is rgb(0, 50, 149)

图片

The border is set to 20PX

图片

Add two more text components to the current node to display the name of the module

图片

For positioning, set it to absolute positioning, and set 36PX from the top and 36PX from the left

图片

Set the font size to 20PX, bold, and set the color to white

图片

Modify the content of the text as a list of candidate information

图片

Let's set the style of the second text component in the same way

图片

After the style is set, we need to add a click event to the image, select the navigation in the platform method

图片

This setting is complete

Summary

In general, PC settings are much more complicated than mobile settings. Especially for the understanding of component concepts, many attributes require manual input of codes, which cannot be set completely on the view, and there is still room for optimization. In the follow-up, we will continue to analyze the official template, and take everyone to familiarize themselves with this new feature.

Author: Han Kai, evangelist with low code in WeTao


CloudBase云开发
425 声望438 粉丝

云开发(Tencent CloudBase,TCB)是云端一体化的后端云服务 ,采用 serverless 架构,免去了移动应用构建中繁琐的服务器搭建和运维。同时云开发提供的静态托管、命令行工具(CLI)、Flutter SDK 等能力极大的降...