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

239
Views
¿Cómo exportar un componente Vue en formato de palabra?

Tengo una plantilla vue que se ve así:

 <template> <div id="printContainer"> <componentA></componentA> <div style="page-break-before:always">&nbsp;</div> <componentB></componentB> <div style="page-break-before:always">&nbsp;</div> <componentC></componentC> </div> </template>

Quiero descargar el HTML del div "printContainer". ¿Alguna sugerencia?

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Puede usar una referencia de plantilla para acceder a printContainer <div> desde el código:

 <script setup> import { ref } from 'vue' const printContainer = ref() </script> <template> <div ref="printContainer"> <!-- your components here --> </div> </template>

y luego obtener su innerHTML . Por ejemplo, podría tener un botón que registre el innerHTML del contenedor al hacer clic:

 <script setup> import { ref } from 'vue' const printContainer = ref() const logContents = () => { console.log('contents', printContainer.value.innerHTML) } </script> <template> <button @click="logContents">Log contents</button> ⋮ </template>

manifestación

about 4 years ago · Santiago Trujillo 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!