include标签无法引入公共代码,是什么原因呀。 Dialog.wxml文件与当前文件在同一路径下。include之后页面看到调试的wxml中没有Dialog.wxml的代码。
代码如下:
< include src= "Dialog.wxml" /> <!-- <view class = "layer-masker" ></view> --> <view class = "container" > <view bindtap= "bindViewTap" class = "userinfo" > <image class = "userinfo-avatar" src= "{{userInfo.avatarUrl}}" background-size= "cover" ></image> <text class = "userinfo-nickname" >{{userInfo.nickName}}</text> </view> <view class = "usermotto" > <text class = "user-motto" >{{motto}}</text> </view> </view> |
@官博, 这个问题是一个BUG吗? 我尝试在另外一个目录中新建一个公共页面是可以引入的,当前目录就不行。
<!--index.wxml-->
<
include
src=
"../common/abc.wxml"
/> <!-- 有效 -->
<
include
src=
"Dialog.wxml"
/> <!-- 无效 -->
<view
class
=
"container"
>
<view bindtap=
"bindViewTap"
class
=
"userinfo"
>
<image
class
=
"userinfo-avatar"
src=
"{{userInfo.avatarUrl}}"
background-size=
"cover"
></image>
<text
class
=
"userinfo-nickname"
>{{userInfo.nickName}}</text>
</view>
<view
class
=
"usermotto"
>
<text
class
=
"user-motto"
>{{motto}}</text>
</view>
</view>
项目结构如下: