So blenden Sie Elemente beim Drucken eines Dokuments ausCSS

CSS verstehen
Anonymous
 So blenden Sie Elemente beim Drucken eines Dokuments aus

Post by Anonymous »

Ich arbeite im Vue-Framework und arbeite derzeit daran, die Webseiten für meine Anwendung zu drucken. Ich brauche eine Lösung für ein Problem. Ich habe es unten angesprochen.

Code: Select all








this text should  be none when printing . if the section1 is none in screen.



var vue_det = new Vue({
el: '#intro',
data: {
timestamp: ''
},
created() {

},
methods: {
printWindow() {
const curURL = document.location.href;
history.replaceState(history.state, '', '/');
const originalTitle = document.title;
document.title = '. ';
window.print();
document.title = originalTitle;
history.replaceState(history.state, '', curURL);
},

computed: {
noprint() {
const printicon = document.getElementById('printReport_AId');
if (printicon.style.display === 'none') {
return true;
}
return false;
},
}

}
});


.non-print-css {
// i have to set the display none for logo when its printed.
}


Ich habe zwei Div-Klassen
  • Abschnitt1
  • Logo.
Bedingung:
  • Wenn Abschnitt 1 keine anzeigt, sollte beim Drucken der Seite das Logo
    nicht gedruckt werden.

    Ich habe in berechnet eine Bedingung hinzugefügt, um zu prüfen, ob die Abschnittsanzeige
    keine ist. Wenn sie wahr ist, sollte das CSS ausgeführt werden, in dem wir @print festgelegt haben.
    Logo-Anzeige ist keine.

    Ich brauche eine richtige Lösung, entweder in CSS oder in JS

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post