小程序 <include >

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

使用

<include  src="../template/template.wxml"/>  
<!--在使用的页面-->
<view class='contact' style='width:100%;height:100rpx'>
 <view  style='width:50%;float:left;height:100rpx;background:rgba(250,250,250,0.6);padding-top:20rpx'  bindtap="makePhoneCall" >
    <view style='float:left;margin-left:60rpx;'>
       <image style='width:70rpx;height:70rpx' src="../../resourse/img/phone.png"></image>
     </view>
     <view style='float:left'>
        <view style='font-size:12px;height:35rpx;line-height:35rpx;color:#707070;'>专属热线</view>
        <view style='font-size:12px;height:35rpx;line-height:35rpx;color:#707070'>{{mobile}}</view>
     </view>
 </view>
 <view   style='width:50%;float:left;height:100rpx;background:rgba(255,0,0,0.6);padding-top:20rpx;text-align:center'>
        <contact-button 
        type="default-light" 
        size="27"
        session-from="weapp" style='width:100%;height:100%;font-szie:12px;color:#fff'>
          联系我们
        </contact-button>
 </view>
</view>
<!--被引用的页面-->

可以看出在被引用的页面里面是没有<template>标签的

include的模板数据也是写在引用的页面里面的,这一点和import是一样的

  

 

posted @ 2017-09-26 17:57  红鲤鱼与绿鲤鱼与绿  阅读(1491)  评论(0编辑  收藏  举报