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

181
Views
pinia: Definir captadores y acciones en notación de función

Estoy en el proceso de implementar una tienda pinia en notación de funciones y me pregunto cómo declarar los getters y las acciones.

¿Se implementan como funciones simples sin distinción?

 import { defineStore } from 'pinia' import HttpService from '../services/BaseHttpService'; import { ref } from 'vue' import { User } from '../models/user.model'; const httpService = new HttpService('/users'); export const useUserStore = defineStore('user', () => { const authedUser = ref(new User()) const users = ref<User[]>([]) function authed() { return typeof authedUser.value['@id'] === "string"; } function login(data: { email: string, password: string }) { const http = new HttpService('/login'); return http.post(data).then((response) => { authedUser.value = response users.value = [...users.value, response] }) } function getter() { return users.value; } function action(id: number) { httpService.get(id).then((response) => { users.value = [...users.value, response] }) } return {authedUser, users, authed, login} })
about 4 years ago · Juan Pablo Isaza
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!