零基础入门Python14|SQLite与SQL CRUD:建立图书数据库
2026/8/21 9:14:46
作用
constapp=getApp()console.log(app.globalData.userInfo)// 获取全局用户信息this.$scope.globalData。getApp({allowDefault: true})获取原始对象。作用
小程序的页面就像叠叠乐的积木,一层一层叠起来(这叫页面栈)。getCurrentPages() 就是用来查看当前叠了多少层积木的。
constpages=getCurrentPages();constcurrentPage=pages[pages.length-1];// 拿到当前页面constprevPage=pages[pages.length-2];// 拿到上一页console.log(currentPage.route);// 打印当前页面的路由路径<script setup>,需要在上一页用defineExpose({ updateData })暴露方法,当前页才能通过prevPage.updateData()调用。作用
对页面进行更底层的原生控制,比如动态修改页面的下拉回弹效果(bounce)、获取页面 ID 等。
// #ifdef APP-PLUS。// #ifdef APP-PLUSconstpages=getCurrentPages();constcurrentPage=pages[pages.length-1];constcurrentWebview=currentPage.$getAppWebview();console.log(currentWebview.id);// #endif