Home  >  Q&A  >  body text

Get array parameters from query in Nuxt.js

<p>I am using Nuxt.js (Nuxt version is 2) I have query parameters on my page <code>https://localhost:9000/applicant?period_manual[]=2022-10-09&period_manual[]=2022-10-19</code></p> <p>I need to get the <code>period_manual</code> parameter from the query. </p> <p>If I try this</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>How to get the data of period_manual[] from the query request? </p>
P粉714780768P粉714780768417 days ago517

reply all(1)I'll reply

  • P粉038856725

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

    try it

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

    reply
    0
  • Cancelreply