微信小程序—引入页面/组件include、import
第一种:我在include页面引入import页面
一定要注意include 和 import标签后面的/
<!-- 引入整个import页面 -->
<include src="../import/import.wxml" />
<text>我是被include页面引入的import页面</text>
效果:
第二种:引入import页面中的组件
<import src="../import/import" />
<template is="a" data="{{a: '模版a的内容'}}"/>
// data要在include.wxml里写
<template name="a">
<text>这里是import页面的模版a--{{a}}</text>
</template>
<template name="b">
<text>这里是import页面的模版b</text>
</template>
效果: