国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 熱點 > 微信 > 正文

taro開發微信小程序的實踐

2024-07-22 01:18:21
字體:
來源:轉載
供稿:網友

在京東凹凸實驗室開發Taro跨平臺早期之前,就已經進行Taro嘗鮮了。開發這個實例 貓眼電影 已經過去幾個月了。案例部分使用的是貓眼電影真實線上接口,關于訂座的座位數據是自己模擬實現的,案例只供參考學習。

開發環境

操作系統:Window 10
Taro版本:v0.0.69
Node版本:v8.11.1
github地址: https://github.com/Harhao/miniProgram

運行效果

 

目錄分析

src 是主要的開發目錄,各個文件實現功能如下所示:

├─.idea│ └─libraries├─.temp├─config└─src ├─assets │ └─images ├─components (公用組件) │ ├─Brandbar │ ├─Selectbar │ ├─Specialbar │ └─Toptab(電影詳情分類) └─pages | ├─cinema(影院列表) | ├─cinemaDetail(影院詳情頁) | ├─content(電影介紹) | ├─detail(電影詳情頁) | ├─map(影院地圖定位頁) | ├─movies(電影列表頁) | ├─order(電影票訂單頁) | ├─person(用戶登錄頁) | ├─position(地理位置選擇頁) | ├─search(電影/影院搜索頁) | ├─seat(影院座位頁) | └─user(用戶中心) |__app.js(入口配置文件) |__app.scss |__index.html

入口配置文件 app.js 分析

Movies 列表頁是微信小程序的首頁,下面代碼中config配置的是小程序中所有使用的頁面定義路由。下面重點介紹幾個比較重要的關鍵點微信小程序頁。

import Taro, { Component } from "@tarojs/taro";import Movies from "./pages/movies/movies";import "./app.scss";class App extends Component { config = { //訪問路由文件定義 pages: [  "pages/movies/movies",  "pages/person/person",  "pages/cinema/cinema",  "pages/position/position",  "pages/search/search",  "pages/detail/detail",  "pages/content/content",  "pages/cinemaDetail/cinemaDetail",  "pages/map/map",  "pages/seat/seat",  "pages/user/user",  "pages/order/order" ], //小程序頂部設置 window: {  backgroundTextStyle: "light",  navigationBarBackgroundColor: "#e54847",  navigationBarTitleText: "貓眼電影",  navigationBarTextStyle: "white",  enablePullDownRefresh: true }, //底部tab導航欄配置 tabBar: {  color: "#333",  selectedColor: "#f03d37",  backgroundColor: "#fff",  borderStyle: "black",  list: [  {   pagePath: "pages/movies/movies",   text: "電影",   iconPath: "./assets/images/index.png",   selectedIconPath: "./assets/images/index_focus.png"  },  {   pagePath: "pages/cinema/cinema",   text: "影院",   iconPath: "./assets/images/themeOld.png",   selectedIconPath: "./assets/images/theme.png"  },  {   pagePath: "pages/person/person",   text: "我的",   iconPath: "./assets/images/person.png",   selectedIconPath: "./assets/images/personSelect.png"  }  ] } }; render() { // Movies小程序入口文件 return <Movies />; }}Taro.render(<App />, document.getElementById("app"));            
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 滕州市| 龙口市| 巨野县| 桐梓县| 抚远县| 青铜峡市| 河间市| 武安市| 锦屏县| 镇巴县| 镇坪县| 博白县| 大洼县| 木里| 攀枝花市| 博兴县| 巴彦淖尔市| 双辽市| 合阳县| 长泰县| 盐津县| 乐平市| 微山县| 永城市| 安多县| 扎赉特旗| 商洛市| 孝昌县| 常宁市| 霍城县| 西贡区| 澄江县| 夹江县| 黔江区| 保靖县| 闻喜县| 阿瓦提县| 新巴尔虎左旗| 玉山县| 闽侯县| 克山县|