選單
×
×
正確!
練習填寫缺失的程式碼,以便當值低於 40 時,觀察者會啟用一個警告類。 <div id="app"> <input type="range" v-model="rangeVal"> <p :class="{ warnClass: warnActive }"><code>{{ rangeVal }}</code></p> </div> <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script> <script> const app = Vue.createApp({ data() { return { rangeVal: 70, warnActive: false } }, watch: { @(13) { if(val<40){ this.warnActive = true; } else{ this.warnActive = false; } } } }) app.mount('#app') </script>
<div id="app"> <input type="range" v-model="rangeVal"> <p :class="{ warnClass: warnActive }"><code>{{ rangeVal }}</code></p> </div> <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script> <script> const app = Vue.createApp({ data() { return { rangeVal: 70, warnActive: false } }, watch: { rangeVal(val) { if(val<40){ this.warnActive = true; } else{ this.warnActive = false; } } } }) app.mount('#app') </script> 不正確點選這裡 重新嘗試。 正確!下一個 ❯ |
這將重置所有 54 個練習的分數。
您確定要繼續嗎?