小程序學習_1

episode 1javascript

微信小程序入門知識點css

1.app.json/....wxml/....wxss/...jshtml

.json 是對於頁面基本屬性的配置(window,tabbar等)java

{
  "pages":[
    "pages/index/index",
    "pages/logs/logs",
    "pages/mytest/mytest",
    "pages/transaction/transaction"
  ],
  "window":{
    "backgroundTextStyle":"light",
    "navigationBarBackgroundColor": "#fff",
    "navigationBarTitleText": "WeChat",
    "navigationBarTextStyle":"black",
    "enablePullDoneRefresh":true
  },
  "tabBar": {
    "color": "#000",
    "selectedColor": "#56abe4",
    "backgroundColor": "#fff",
    "borderStyle": "white",
    "list": [
      {
        "pagePath": "pages/index/index",
        "text": "首頁",
        "iconPath": "images/latest.png",
        "selectedIconPath": "images/lastest_on.png"
      },
      {
        "pagePath": "pages/logs/logs",
        "text": "回款",
        "iconPath": "images/hotest.png",
        "selectedIconPath": "images/hotest_on.png"
      },
      {
        "pagePath": "pages/transaction/transaction",
        "text": "個人",
        "iconPath": "images/hotest.png",
        "selectedIconPath": "images/hotest_on.png"
      }
    ]
  },
  "debuge":true
}

在這個部分不容許有註釋。編程

2.js 毋庸多說,JavaScript該幹嗎幹嗎,這裏聽老師說是隻運用到了核心功能。json

3....wxml——>html文件小程序

4.....wxss——>css文件微信小程序

以上是微信小程序的結構說明。接下來就是零散知識點。微信

js:Page({})app

須要在json中註冊頁面;

在單個page下的json,wxss均覆蓋app的對應文件。

java中業務分離的思想也在小程序的編程中體現出來了:

js中:

// pages/transaction/transaction.js
Page({

  /**
   * 頁面的初始數據
   */
  data: {
    btndefa:"第一個按鈕",
    btnprim:"第二個按鈕",
    textinform:"original content"
  },

  /**
   * 生命週期函數--監聽頁面加載
   */
  onLoad: function (options) {
  
  },

  /**
   * 生命週期函數--監聽頁面初次渲染完成
   */
  onReady: function () {
  
  },

  /**
   * 生命週期函數--監聽頁面顯示
   */
  onShow: function () {
  
  },

  /**
   * 生命週期函數--監聽頁面隱藏
   */
  onHide: function () {
  
  },

  /**
   * 生命週期函數--監聽頁面卸載
   */
  onUnload: function () {
  
  },

  /**
   * 頁面相關事件處理函數--監聽用戶下拉動做
   */
  onPullDownRefresh: function () {
  
  },

  /**
   * 頁面上拉觸底事件的處理函數
   */
  onReachBottom: function () {
  
  },

  /**
   * 用戶點擊右上角分享
   */
  onShareAppMessage: function () {
  
  },
  primar:function(){
    console.log("第二個按鈕被點擊"),
    this.setData({textinform:"內容又沒了"});
  }
})

{數據綁定}data中定義數據,以後是函數。【在wxml中應運的時候採用 content:{{subject}}】

今天觀察到老師一個錯誤的習慣:var parameter=    content:.......

再者,冒泡事件和非冒泡事件,及其關聯的bind和catch

冒泡就是石頭往下扔泡泡往上翻,表明順帶執行其餘函數。


渲染:wx:if={{}}

          wx:else

          wx:for="[....,....,.....,.......]"

子元素定死爲item


include,import(template)【import無接力性質】

相關文章
相關標籤/搜索