Skip to content

getPageOpts() ​

getPageOpts() 函数用于获取当前页面参数。

示例 ​

如果在 pages.json 中配置 routers 了,并且 routers 中的 path 带有路径参数,如 home/:id 。

js
// id 为路径参数,type 为 query 参数
const theOptions = qin.getPageOpts();
console.log(theOptions); // 输出为 { id: 1, type: 'qinjs'}
// id 为路径参数,type 为 query 参数
const theOptions = qin.getPageOpts();
console.log(theOptions); // 输出为 { id: 1, type: 'qinjs'}