screen_rotation
Copied to Clipboard
<!DOCTYPE html> <html> <head> <script src="https://unpkg.com/vue@3.2.22/dist/vue.global.js"></script> </head> <body> <div id="app"> <h1>Vue Js Ternary Operator Example</h1> <h2>{{ showMessage ? 'Hello, world!' : '' }}</h2> <button @click="showMessage = !showMessage ">{{ showMessage ? 'Hide Message' : 'Show Message' }}</button> </div> <script type="module"> const app = Vue.createApp({ data() { return { showMessage: true } }, }) app.mount('#app') </script> <style scoped> #app { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100vh; background-color: #f2f2f2; } h1 { font-size: 2rem; text-align: center; } h2 { font-size: 1.5rem; text-align: center; margin-top: 2rem; } button { margin-top: 2rem; padding: 1rem; border: none; border-radius: 0.5rem; background-color: #007aff; color: #fff; font-size: 1rem; cursor: pointer; } button:hover { background-color: #0066d9; } </style> </body> </html>