include 的文件中,找不到 Template 名
发布于 5 年前 作者 hfeng 6640 次浏览 来自 问答

看文档

include可以将目标文件除了<template/>的整个代码引入,相当于是拷贝到include位置

我在 index.html 中 include 了 footer.wxml,

footer.wxml 中可以引用 index.js 中的 data,

然而 我在 index.html 中 定义了一个模板

<template name="name">
  <view>index中的模板</view>
</template>

然后在 footer.wxml 中 引用

<template is="name" />

预览的时候报

Template “name” not found.

include 中的模板也是有作用域?

2 回复

已经在 index.wxml 中 <include src=“footer.wxml”/> 了。

已经包含进去。

回到顶部