在微信小程序中怎样使用模板

2024-10-14 20:57:43

1、首先我们打开微信小程序的项目文件目录。

在微信小程序中怎样使用模板

3、在该wxml文件中使用template标签来定义模板,同时命名。<template name=媪青怍牙"message"> <view class="message-group"> <text class="content">{{content}}</text> <text class="friend">{{friend}}</text> </view></template>

在微信小程序中怎样使用模板

5、然后再来到pages页面下,找到要引入模板文件的wxml文件。

在微信小程序中怎样使用模板

7、然后指定使用哪一个模板文件,并且自定义变量内容。<template is屏顿幂垂="message" data="{{content:'让我们一起去旅游吧',friend:'小明'}}">

在微信小程序中怎样使用模板
猜你喜欢