运行 ❯
获取您
的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <head> <title>Typewriters</title> <style> #app { border: dashed black 1px; width: 130px; padding-left: 20px; font-weight: bold; background-color: lightgreen; } </style> </head> <body> <h1>Example with 'v-if' and 'v-else'</h1> <p>Try changing the 'typewritersInStock' value in the Vue instance from 'true' to 'false' and run the code again.</p> <div id="app"> <p v-if="typewritersInStock"> in stock </p> <p v-else> not in stock </p> </div> <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script> <script> const app = Vue.createApp({ data() { return { typewritersInStock: true } } }) app.mount('#app') </script> </body> </html>