文章来自:源码在线https://www.shengli.me/wxxcx/122.html
WXML 提供两种文件引用方式import
和include
。
import
import
在该文件中使用目标文件定义的template中如:
在 item.wxml 中定义了一个叫item
的template
:
在 index.wxml 中引用了 item.wxml,就可以使用item
模板:
include
include
可以将目标文件除了<template/>
<wxs/>
外的整个代码引入,相当于是拷贝到 include
位置,如: