搜尋

首頁  >  問答  >  主體

從 Nuxt.js 中的查詢取得數組參數

<p>我正在使用Nuxt.js(Nuxt版本是2) 我的頁面上有查詢參數 <code>https://localhost:9000/applicant?period_manual[]=2022-10-09&period_manual[]=2022-10-19</code></p> <p>我需要從查詢中取得 <code>period_manual</code> 參數。 </p> <p>如果我嘗試這樣做</p> <pre class="brush:php;toolbar:false;">console.log(this.$route.query.period_manual) //- It is undefined console.log(this.$route.query) //- this outputs {period_manual[]: ["2022-10-16", "2022-10-25"]} console.log(this.$route.query.period_manual[]) //- ESLint error - ESLint: Parsing error: An element access expression should take an argument</pre> <p>如何從查詢請求中取得 period_manual[] 的資料? </p>
P粉714780768P粉714780768559 天前604

全部回覆(1)我來回復

  • P粉038856725

    P粉0388567252023-08-29 11:10:19

    嘗試一下

    1

    this.$route.query['period_manual[]']

    回覆
    0
  • 取消回覆