Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

172
Views
¿Cómo puedo acceder al estado calculado desde creado?

¿Cómo puedo acceder al estado de mi url que he calculado desde la creación?

 computed:{ ...mapState({ url: state => state.generics.myUrl, }), }, created: function(){ axios({ method: 'GET', url: this.url }).then((response) => { }); },
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puede crear getter o probar de la siguiente manera:

 computed:{ ...mapState({ url: ({ generics: { myUrl} }) => myUrl, }), }, 

 const store = new Vuex.Store({ state: { generics: { myUrl: 'https://reqres.in/api/products/1', } }, }) Vue.config.productionTip = false Vue.config.devtools = false new Vue({ store, el: "#app", computed: { ...Vuex.mapState({ url: ({ generics: { myUrl} }) => myUrl, }), }, created() { axios({ method: 'GET', url: this.url }).then((response) => { console.log(response.data) }) } })
 <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script> <script src="https://unpkg.com/vuex "></script><script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.23.0/axios.min.js" integrity="sha512-Idr7xVNnMWCsgBQscTSCivBNWWH30oo/tzYORviOCrLKmBaRxRflm2miNhTFJNVmXvCtzgms5nlJF4az2hiGnA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script> <div id="app"> {{ url }} </div>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!