为什么模板不能引用
发布于 4 年前 作者 fang71 7702 次浏览 来自 问答

<!–index.wxml–>

<!–引入模板–>

<import scr="…/common/common" />

<view class=“container”>

  <!–编写输入框–>

  <view class=“header”>

    <input class=“search” placeholder="{{subTitle}}" placeholder-class=“search-placeholder” bindchange=“handleSearch” auto-focus=“true” />

  </view>

  <template is=“movies-list” data="{{movies}}"></template>

</view>

<!–common.wxml–>

<template name=“movies-list”>

  <scroll-view scroll-y=“true” class=“list”>

    <template is=“item1” data="{{item}}" wx:for="{{movies}}" wx:key=“id”></template>

  </scroll-view>

</template>

1 回复

模版可以被import。请检查模板路径是否填写正确,控制台是否有warning

回到顶部