mycurelabs / vue-html-to-paper

Vue mixin for paper printing html elements.
MIT License
298 stars 101 forks source link

How to show some elements that are hidden on html? #42

Closed AleksandarMiha closed 4 years ago

AleksandarMiha commented 4 years ago

Hello i want to show any element which is hidden in html. Example

<div id="printMe">
<h1> Show show </h1>
<p> I WANT THIS P TAG TO HIDE FROM HTML BUT SHOW IN VUE PAPER </p>
</div>

Thanks.

AleksandarMiha commented 4 years ago

@warlock jofftiquez

AleksandarMiha commented 4 years ago

@jofftiquez

AleksandarMiha commented 4 years ago

@igemnace

jofftiquez commented 4 years ago

Use v-if set the default value to false. Then make it true when the print method is called.

AleksandarMiha commented 4 years ago

@jofftiquez
it is no work Check my question https://stackoverflow.com/questions/61126059/how-to-hide-element-in-vue-html-to-paper/61126377?noredirect=1#comment108142285_61126377

AleksandarMiha commented 4 years ago

@jofftiquez @igemnace @warlock @enometsys @

jofftiquez commented 4 years ago

Hello @AleksandarMiha we appreciate you for using our plugin, however, the problem you're encountering is not part of the solution that this plugin is offering. Can you maybe create a reproduction via codepen or jsfiddle? Thanks.

jofftiquez commented 4 years ago

@AleksandarMiha do this:

print () {
  this.showInPrint = true; // show the <p> tag

  // Use nextTick to trigger the print on next update
  this.$nextTick(() => {
    vm.$htmlToPaper('printMe', null, () => {
      console.warn('done');
      this.showInPrint = false; // hide the <p> tag when printing is done
    });
  });
},
AleksandarMiha commented 4 years ago

Yes friend. Solution is this.$nextTick. Thanks :)

AleksandarMiha commented 4 years ago

Hmm but i have another problem. When i goes to print function. If go to cancel I lose my element in html. I need go to refresh page to see again p tag. Solution?

AleksandarMiha commented 4 years ago

@jofftiquez @warlock @enometsys @igemnace