在uniapp中獲取url中的參數(shù)值可以通過(guò) this.$route.query
或者 this.$mp.query
來(lái)獲取。
假設(shè)你要獲取url中的code參數(shù),可以使用以下代碼:
// 獲取query對(duì)象
const query = this.$route.query;
// 獲取code參數(shù)
const code = query.code;
或者文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-633238.html
// 獲取query對(duì)象
const query = this.$mp.query;
// 獲取code參數(shù)
const code = query.code;
其中,第一種方法適用于h5、APP和微信小程序等平臺(tái),而第二種方法只適用于微信小程序平臺(tái)。文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-633238.html
到了這里,關(guān)于【uniapp】獲取url中的參數(shù)this.$route.query或this.$mp.query的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!