11. Import and include two ways to introduce templates< /p>
Import:
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
2.Write code in the template file user.wxml
3.In cate.js Write code in data
4. Introduce the template in user.wxml into the file cate.wxml that calls the template
p>
5. Simulation page display:
Include:
Include cannot use tepmlate tag and wxml tag.
Steps:
- Template file user .wxml
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
cate.js: (the same way as import)
12. WXSS style-selector:
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
2. Write the style in cate.wxss:
3.::after tag and ::before tag
Add text tags in cate.wxml
View the renderings:
The same goes for:before: