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

148
Views
La propiedad no existe

ok, puede ser simple, pero esto me tiene desconcertado

tengo un SFC definido usando

 export default defineComponent({ setup(): { args: Args; preview: Point[] } { const args = new Args(); const preview: Point[] = []; args.values.push(...args.shape.shapeArgs.map((d) => d.default)); return { args, preview: preview }; }, computed: { previewSize() { return { width: (Math.max(1, ...this.preview.map((p) => px)) + 40) * 10, height: (Math.max(1, ...this.preview.map((p) => py)) + 40) * 10, }; }, ...

sin embargo, no funcionará porque

 TS2339: Property 'preview' does not exist on type 'ComponentPublicInstance<{} | {}, {}, {}, {}, {}, EmitsOptions, {} | {}, {}, false, ComponentOptionsBase<{} | {}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, EmitsOptions, string, {}>>'. Property 'preview' does not exist on type '{ $: ComponentInternalInstance; $data: {}; $props: {} | {}; $attrs: Record<string, unknown>; $refs: Record<string, unknown>; $slots: Readonly<InternalSlots>; ... 7 more ...; $watch(source: string | Function, cb: Function, options?: WatchOptions<...> | undefined): WatchStopHandle; } & ... 4 more ... & ComponentCustom...'. 56 | previewSize() { 57 | return { > 58 | width: (Math.max(1, ...this.preview.map((p) => px)) + 40) * 10, | ^^^^^^^

como la vista previa está claramente definida, estoy desconcertado de por qué no existe

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Esto es de la documentación mecanografiada de Vue3 sobre computado

 import { defineComponent, ref, computed } from 'vue' export default defineComponent({ name: 'CounterButton', setup() { let count = ref(0) // read-only const doubleCount = computed(() => count.value * 2) const result = doubleCount.value.split('') // => Property 'split' does not exist on type 'number' } })

Puedes intentar hacer algo como:

 export default defineComponent({ setup(): { args: Args; preview: Point[] } { const args = new Args(); const preview: Point[] = []; args.values.push(...args.shape.shapeArgs.map((d) => d.default)); const previewSize = computed(() => ({ width: (Math.max(1, ...this.preview.map((p) => px)) + 40) * 10, height: (Math.max(1, ...this.preview.map((p) => py)) + 40) * 10, })) return { args, preview: preview, previewSize: previewSize }; } ...
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!