12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title>1.引入VUE</title>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <script src="https://unpkg.com/vue/dist/vue.js"></script>
- <link href="../css/style.css" rel="stylesheet"> </head>
- </head>
- <body>
- <div id="app">
- <h1>您的成绩评价</h1>
- <div v-if="score > 80">
- score:{{score}} 优秀生
- </div>
- <div v-else-if="score > 60">
- score:{{score}} 中等生
- </div>
- <div v-else>
- score:{{score}} 不及格
- </div>
- <div><button @click="btnClick">改变</button></div>
- </div>
- <script>
- new Vue({
- el: '#app',
- data: {
- score: 0
- },
- methods: {
- btnClick: function() {
- this.score = Math.round(Math.random() * 100);
- },
- },
- })
- </script>
- </body>
- </html>
|