PoliWen
PoliWen
```vue import { ref, watch } from "vue" const count = ref(0) /** * Implement the until function */ function until(initial) { function toBe(value) { return new Promise(resolve)=> { const...
```vue import { defineComponent, h } from "vue" export default defineComponent({ name: 'MyButton', props:{ disabled:{ type: Boolean, default: false } }, render() { return h('button', { disabled: this.disabled, onClick:() =>...
```vue // 你的答案 /** * Implement the custom directive * Make sure the `onClick` method only gets triggered once when clicked many times quickly * And you also need to...
```vue Hello Vue.js p { font-size:20px; color:red; text-align: center; line-height: 50px; } /* Make it work */ :global(body) { width: 100vw; height: 100vh; background-color: burlywood; } /* 还有一个插槽选择器 */ :slotted(selector){...
```vue A A A function onClick1(){ console.log('onClick1') } function onShiftClick(){ console.log('onShiftClick') } function onClick2(){ console.log('onClick2') } ```
```vue import {ref,onMounted,onUnmounted} from "vue" // Implement ... function useEventListener(target, event, callback) { onMounted(() => target.addEventListener(event,callback)) onUnmounted(()=> target.removeEventListener(event,callback)) } // Implement ... function useMouse() { const x = ref(0) const...
```vue import { reactive, isReactive, toRaw, markRaw} from "vue" const state = { count: 1 } const reactiveState = reactive(state) /** * Modify the code so that we can make...
```vue // 父组件 App.vue import {ref,computed} from "vue" const count = ref(1) const plusOne = computed({ get(){ return count.value + 1 }, set(value){ // count.value = value - 1 count.value++...
```vue import { shallowRef, watch } from "vue" const state = shallowRef({ count: 1 }) // Does NOT trigger watch(state, () => { console.log("State.count Updated") }, { deep: true })...
```vue defineProps({ type: { type:String, validator(value){ return ['primary','ghost','dashed','link','text','default'].includes(value) }, default:'default' }, }) Button // https://sfc.vuejs.org/#eNp9UU1PwzAM/StRLh3S1tyrMgl+ARJHwiFb3S2j+ZDjDKZp/x2njYaEEKf42c8v9vNVPsXYnjPITvZpjzaSSEA5brW3LgYk8ZyJghcjBie0bNWCS4+W2vdq6WI+AwIXJ0PASIi+dtIlwqOWk/UfWiou9erOk2v5o/fHDAOM1sMLhphW1yJaxDoxhxW8Elp/WC+Zs5nsYCjgiqMMD5UoBLIgevHWRLTO4KVZN4djSMTvYNIRBg7KhPwQfM1pGE2eqHlvrd9PeYBUNRfJW/2x0ro7v6RL8cbE/9zZzXtvl/V7VeFvd5YjbJyJ7SkFzxbNK+laSFre3dByvknHwZEopk6pNO6LsafUBjwojlrMnqyDFpLb7DB8JkAWLpfkqXloefsGeHO3hw== ```