从嘉
从嘉
```vue // your answers import { ref } from "vue" const count = ref(2) setInterval(() => { count.value++ console.log(count.value) }, 1000) Make it never change: {{ count }} ```
```vue // your answers import { ref, computed, watch, watchEffect, effectScope } from "vue" const scope = effectScope() const counter = ref(1) const doubled = computed(() => counter.value * 2)...
```vue // your answers import { reactive, isReactive,toRaw, markRaw } from "vue" const state = { count: 1 } const reactiveState = reactive(state) /** * Modify the code so that...
```vue // your answers defineProps({ type: { default: 'default', validator(value) { return ['primary', 'ghost', 'dashed', 'link', 'text', 'default'].includes(value) } }, }) Button ```
```vue // your answers const click1 = () => { console.log('click1') } const click2 = (e) => { console.log('click2', e) // e.stopPropagation() } click me ```
```vue // your answers import { ref } from "vue" const theme = ref("red") const colors = ["blue", "yellow", "red", "green"] setInterval(() => { theme.value = colors[Math.floor(Math.random() * 4)] },...
```vue // your answers import { ref, nextTick } from "vue" const count = ref(0) const counter = ref(null) function increment() { count.value++ /** * DOM is not yet updated,...
```vue // your answers import { onMounted, inject, onUnmounted } from "vue" const timer = inject("timer") const count = inject("count") onMounted(() => { timer.value = window.setInterval(() => { count.value++ },...
```vue // your answers // Add a piece of code to make the `count` value get injected into the child component. import { inject } from "vue" const count =...