<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                # 注冊頁面 對于小程序中的每個頁面,都需要在頁面對應的?js?文件中進行注冊,指定頁面的初始數據、生命周期回調、事件處理函數等。 ## 使用 Page 構造器注冊頁面 簡單的頁面可以使用?Page()?進行構造。 代碼示例: ~~~ //index.js Page({ data: { text: "This is page data." }, onLoad: function(options) { // 頁面創建時執行 }, onShow: function() { // 頁面出現在前臺時執行 }, onReady: function() { // 頁面首次渲染完畢時執行 }, onHide: function() { // 頁面從前臺變為后臺時執行 }, onUnload: function() { // 頁面銷毀時執行 }, onPullDownRefresh: function() { // 觸發下拉刷新時執行 }, onReachBottom: function() { // 頁面觸底時執行 }, onShareAppMessage: function () { // 頁面被用戶分享時執行 }, onPageScroll: function() { // 頁面滾動時執行 }, onResize: function() { // 頁面尺寸變化時執行 }, onTabItemTap(item) { // tab 點擊時執行 console.log(item.index) console.log(item.pagePath) console.log(item.text) }, // 事件響應函數 viewTap: function() { this.setData({ text: 'Set some data for updating view.' }, function() { // this is setData callback }) }, // 自由數據 customData: { hi: 'MINA' } }) ~~~ 詳細的參數含義和使用請參考?[Page 參考文檔](https://www.w3cschool.cn/weixinapp/weixinapp-sxd138ql.html)?。 ## 在頁面中使用 behaviors > 基礎庫 2.9.2 開始支持,低版本需做[兼容處理](https://www.w3cschool.cn/weixinapp/compatibility.html?RECACHE=1)。 頁面可以引用 behaviors 。 behaviors 可以用來讓多個頁面有相同的數據字段和方法。 ~~~ // my-behavior.js module.exports = Behavior({ data: { sharedText: 'This is a piece of data shared between pages.' }, methods: { sharedMethod: function() { this.data.sharedText === 'This is a piece of data shared between pages.' } } }) ~~~ ~~~ // page-a.js var myBehavior = require('./my-behavior.js') Page({ behaviors: [myBehavior], onLoad: function() { this.data.sharedText === 'This is a piece of data shared between pages.' } }) ~~~ 具體用法參見?[behaviors](https://www.w3cschool.cn/weixinapp/weixinapp-tghb38sa.html)?。 ## 使用 Component 構造器構造頁面 > 基礎庫 1.6.3 開始支持,低版本需做[兼容處理](https://www.w3cschool.cn/weixinapp/compatibility.html?RECACHE=1)。 Page?構造器適用于簡單的頁面。但對于復雜的頁面,?Page?構造器可能并不好用。 此時,可以使用?Component?構造器來構造頁面。?Component?構造器的主要區別是:方法需要放在?methods: { }?里面。 代碼示例: ~~~ Component({ data: { text: "This is page data." }, methods: { onLoad: function(options) { // 頁面創建時執行 }, onPullDownRefresh: function() { // 下拉刷新時執行 }, // 事件響應函數 viewTap: function() { // ... } } }) ~~~ 這種創建方式非常類似于?自定義組件?,可以像自定義組件一樣使用?behaviors?等高級特性。 具體細節請閱讀?[Component?構造器](https://www.w3cschool.cn/weixinapp/weixinapp-453938s7.html)?章節。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看