Vue: window.print(); after content changed

Created on 21 Nov 2017  路  3Comments  路  Source: vuejs/vue

Version

2.5.3

Reproduction link

https://jsfiddle.net/50wL7mdz/77812/

Steps to reproduce

Click the print link

What is expected?

i want to print "Print Me"

What is actually happening?

it will need to click second time only it change the content

Most helpful comment

change data don't update DOM immediately, you need execute window.print like this:

printNow(value){
  this.print = value;

  this.$nextTick(() => {
    window.print();
  });
}

All 3 comments

change data don't update DOM immediately, you need execute window.print like this:

printNow(value){
  this.print = value;

  this.$nextTick(() => {
    window.print();
  });
}

What @anhulife said 馃檪

change data don't update DOM immediately, you need execute window.print like this:

printNow(value){
  this.print = value;

  this.$nextTick(() => {
    window.print();
  });
}

It works!!!!!!!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Akryum picture Akryum  路  34Comments

RashadSaleh picture RashadSaleh  路  51Comments

ecmel picture ecmel  路  52Comments

wenLiangcan picture wenLiangcan  路  39Comments

asiFarran picture asiFarran  路  34Comments