First school applet – configuration problem (3)

11. Import and include two ways to introduce templates< /p>

Import:

Share pictures

Template file:common/tmplates/user.wxml

File for calling template: /pages/cate/cate.wxml

< p>Steps:

1.Create a new folder common/tmplates/user.wxml

Share a picture

2.Write code in the template file user.wxml

Share the picture

3.In cate.js Write code in data

Share picture

4. Introduce the template in user.wxml into the file cate.wxml that calls the template

p>

share picture

5. Simulation page display:

Share a picture

Include:

share picture

Include cannot use tepmlate tag and wxml tag.

Steps:

  1. Template file user .wxml

share picture

Include The method is different from import, you need to add “attribute.” in front of the element name, as shown in the figure above.

2. The file to call the template: cate.wxml

Share a picture

cate.js: (the same way as import)

share picture

12. WXSS style-selector:

share picture

Like css, there are many styles without css support!

Global style: app.wxss

Local style: written in the wxss file in the current file.

1. Write a template in pages/cate.wxml

share picture

2. Write the style in cate.wxss:

share picture

3.::after tag and ::before tag

Add text tags in cate.wxml

Address: China

View the renderings:

Share pictures

The same goes for:before:

Share a picture

Share a picture

Leave a Comment

Your email address will not be published.