Skip to content
Discussion options

You must be logged in to vote

Ok, so computed property will cause an type assert loop error. So I have to write another type to handle this situation.

// can also use interface
type Person = {
  name: string
  age: number
  tel: string
  concatData: string
}

const person: Person = reactive({
  name: 'Kevin',
  age: 12, 
  tel: '0912345678',
  concatData: computed(() => {
    return `name: ${person.name}, age:${person.age}, phone: ${person.tel}`
  })
})

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Mayvis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant