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

fergaldoyle picture fergaldoyle  路  3Comments

seemsindie picture seemsindie  路  3Comments

6pm picture 6pm  路  3Comments

paulpflug picture paulpflug  路  3Comments

robertleeplummerjr picture robertleeplummerjr  路  3Comments