Recently, I have been more impetuous with all kinds of things and troubles, and now I start to calm down and write a blog. If you learn technology, you can't be impetuous and keep it in your heart all the time, and inspire yourself to hope that you can inspire everyone. Recently, I have been developing small programs. I haven't studied systematically, just pick it up and do it. The writing is not good. Please give me some advice.
Step 1: Create a new directory
Create a new templates directory under the pages directory (tip: write "pages/templates/foot" in the pages of the app.json file, it will be automatically generated for us ), this directory is used to store public templates. Here is the directory we created:
Step 2: Define the template
Write the code in our newly created foot.wxml file as follows:
< template name ="foot" > < text > I am the bottom </ text > </ template >
name is the attribute of template, as the name of the template.
Step 3: Referencing the Template
Now we reference this template in pages/index/index.wxml.
<import src="../templates/foot"/> <template is="foot"></template>
src="../templates/foot" template path
is="foot" template name
Available now