菜单
×
×
正确!
练习编写缺失的代码,以便当值低于 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 道练习的分数。
您确定要继续吗?