怎么在微信小程序中使用自定義模版-創(chuàng)新互聯(lián)

怎么在微信小程序中使用自定義模版?針對這個問題,這篇文章詳細介紹了相對應的分析和解答,希望可以幫助更多想解決這個問題的小伙伴找到更簡單易行的方法。

創(chuàng)新互聯(lián)堅持“要么做到,要么別承諾”的工作理念,服務領域包括:網(wǎng)站設計制作、做網(wǎng)站、企業(yè)官網(wǎng)、英文網(wǎng)站、手機端網(wǎng)站、網(wǎng)站推廣等服務,滿足客戶于互聯(lián)網(wǎng)時代的曲江網(wǎng)站設計、移動媒體設計的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡建設合作伙伴!

1、新建一個wxml(為測試方便,這里將wxml文件建立在home目錄下)

/home/home/botmenu.wxml:

<template name="bottommenu">
  <view class="bottomposition">
   <navigator class="item_info" url="../home/home">
     <image src="../img/sy.png"></image>
     <text>首頁</text>
   </navigator>
   <navigator class="item_info" url="/pages/home/home">
     <image src="../img/xx.png"></image>
     <text>消息</text>
   </navigator>
   <navigator class="item_info" url="/pages/home/home">
     <image src="../img/lz.png"></image>
     <text>工具</text>
   </navigator>
   <navigator class="item_info" url="/pages/home/home">
     <image src="../img/wo.png"></image>
     <text>我</text>
   </navigator>
  </view>
</template>

2、新建wxss

/home/home/botmenu.wxss:

.bottomposition{
 width: 100%;
 height: 10%;
 position: fixed;
 overflow: hidden;
 left: 0;
 top: 90%;
z-index: 1100;
 display: flex;
 border-top: 1rpx solid #dadada;
}
.item_info {
 width: 25%;
 height: 100%;
 display: flex;
 align-items: center;
 flex-direction: column;
 justify-content: center;
}
.item_info image {
 width: 20px;
 height: 20px;
}
.item_info text {
 margin-top: 5px;
 font-size: 12px;
}
.infolist{
 margin:10px;
 padding: 0 10px;
 font-size: 12px;
}

3、頁面引用

<import src="../home/home.wxml"/>
<view class="info">
 <template is="bottommenu"></template>
</view>

4、頁面樣式引用

@import "../home/home.wxss";

5、index.js中的data數(shù)據(jù):

data: {
 tool_list:[{
  name:"在線JavaScript代碼美化、格式化工具",
  url:"http://tools.jb51.net/code/js"
 },{
  name:"json代碼在線格式化/美化/壓縮/編輯/轉(zhuǎn)換工具",
  url:"http://tools.jb51.net/code/jsoncodeformat"
 },{
  name:"中文繁體字簡體字轉(zhuǎn)換(繁簡轉(zhuǎn)換)工具",
  url:"http://tools.jb51.net/transcoding/convertzh"
 },{
  name:"正則表達式在線生成工具",
  url:"http://tools.jb51.net/regex/create_reg"
 },{
  name:"XML代碼在線格式化美化工具",
  url:"http://tools.jb51.net/code/xmlcodeformat"
 },{
  name:"在線科學計算器",
  url:"http://tools.jb51.net/jisuanqi/jsqkexue"
 },{
  name:"BASE64編碼解碼工具",
  url:"http://tools.jb51.net/transcoding/base64"
 }]
 },

6、index.wxml

<!--index.wxml-->
<view class='userinfo'>創(chuàng)新互聯(lián)成都網(wǎng)站設計公司在線工具</view>
<view wx:for="{{tool_list}}" class="infolist">
 <text>{{item.name}} - {{item.url}}</text>
</view>
<import src="../home/home.wxml"/>
<view class="info">
 <template is="bottommenu"></template>
</view>

關于怎么在微信小程序中使用自定義模版問題的解答就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,如果你還有很多疑惑沒有解開,可以關注創(chuàng)新互聯(lián)成都網(wǎng)站設計公司行業(yè)資訊頻道了解更多相關知識。

另外有需要云服務器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務器、裸金屬服務器、高防服務器、香港服務器、美國服務器、虛擬主機、免備案服務器”等云主機租用服務以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應用場景需求。

新聞標題:怎么在微信小程序中使用自定義模版-創(chuàng)新互聯(lián)
轉(zhuǎn)載源于:http://bm7419.com/article30/ddjjso.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供小程序開發(fā)、網(wǎng)頁設計公司、品牌網(wǎng)站制作、響應式網(wǎng)站、商城網(wǎng)站、用戶體驗

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

搜索引擎優(yōu)化