include引入wxml时编译报错。
场景:希望做两个wxml文件(pagehead.wxml、pagefoot.wxml)被其他页面引入,目的是让页面内容更加简洁。发现小程序开发工具,会在编译时报错如下:
以下是三个wxml文件内容:
pagehead.wxml:
<view class="page">
<view class="page__hd">
<view class="page__title">{{pageInfo.title}}</view>
<view class="page__desc">{{pageInfo.desc}}</view>
</view>
<view class="page__bd page__bd_spacing"><!--框架头与页面内容空3行-->
pagefoot.wxml:
</view><!--框架尾与页面内容空3行-->
</view>
当被index.wxml对上述两个文件引入:
<include src="../tplt/pagehead.wxml"/>
<view bindtap="bindViewTap" class="userinfo">
<image wx:if="{{userInfo.avatarUrl}}"
class="userinfo-avatar" src="{{userInfo.avatarUrl}}" background-size="cover"/>
<text class="userinfo-nickname">{{userInfo.nickName}}</text>
<text class="user-motto">{{motto}}</text>
</view>
<!--view hidden="{{!newUser}}"-->
<view>
<button class='weui-btn' bindtap="setRoleLbor" type="primary">AAA</button>
<button class="weui-btn" bindtap="setRoleClnt" type="primary">BBB</button>
</view>
<include src="../tplt/pagefoot.wxml"/>
1 回复