애플릿이 현재 경로와 파라미터를 가져옵니다
5032 단어 애플릿
기본용법
경로 가져오기
var pages = getCurrentPages(); //
var currentPage = pages[pages.length - 1] //
var url = currentPage.route // url
console.log(url); // url
----경로의 매개 변수 가져오기
방법 1
var pages = getCurrentPages(); //
var currentPage = pages[pages.length - 1] //
const options = currentPage.options //
console.log(options); //
메서드2: onLoad에서 사용해야 함
onLoad: function (options) {
console.log(options) //
}
방갱 지침서
var pages = getCurrentPages(); //
var currentPage = pages[pages.length - 1] //
const options = currentPage.options
console.log(options);
onLoad: function (options) {
var that = this;
that.setData({
id: 1,
})
}