screen_rotation
Copied to Clipboard
<!DOCTYPE html> <html lang="en"> <head> <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> </head> <body> <div id="app"> <h3>Vue Js Notification Popup</h3> <button @click="showNotification">Show Notification Popup</button> <div class="notification-popup" v-if="show"> <div class="notification-content"> <div class="notification-message">{{ message }}</div> <button class="notification-close" @click="closeNotification">Close</button> </div> </div> </div> <script type="module"> const app = new Vue({ el: "#app", data() { return { show: false, message: '' }; }, methods: { showNotification() { this.message = 'This is Notification Popup'; this.show = true; setTimeout(() => { this.closeNotification(); }, 10000); // Close the notification after 10 seconds }, closeNotification() { this.show = false; this.message = ''; } } }); </script> <style scoped> h3 { color: #333; } button { padding: 10px 20px; background-color: #007bff; color: #fff; border: none; cursor: pointer; } .notification-popup { position: fixed; top: 20px; right: 20px; z-index: 9999; background-color: #ffffff; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); padding: 10px; border-radius: 4px; } .notification-content { display: flex; align-items: center; } .notification-message { flex: 1; margin-right: 10px; color: #333333; } .notification-close { background: none; border: none; color: #888888; cursor: pointer; font-size: 16px; padding: 0; transition: color 0.3s; } .notification-close:hover { color: #555555; } </style> </body> </html>