|
|
|
@ -14,7 +14,7 @@
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
<script setup lang="ts">
|
|
|
|
import { ref } from 'vue';
|
|
|
|
import { ref, reactive, computed } from 'vue';
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 题目 1. 冒泡排序
|
|
|
|
* 题目 1. 冒泡排序
|
|
|
|
@ -154,6 +154,19 @@ function useDeepClone() {
|
|
|
|
console.log('深拷贝的新值', deepCloneA);
|
|
|
|
console.log('深拷贝的新值', deepCloneA);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function useVue3Computed() {
|
|
|
|
|
|
|
|
const state = reactive({
|
|
|
|
|
|
|
|
count: 1,
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const doubleCount = computed(() => {
|
|
|
|
|
|
|
|
console.log('computed');
|
|
|
|
|
|
|
|
return state.count * 2;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
state.count++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** 拿到script中所有方法 */
|
|
|
|
/** 拿到script中所有方法 */
|
|
|
|
const functionArray = ref([
|
|
|
|
const functionArray = ref([
|
|
|
|
{ name: 'useBubbleSort', func: useBubbleSort },
|
|
|
|
{ name: 'useBubbleSort', func: useBubbleSort },
|
|
|
|
@ -161,5 +174,6 @@ const functionArray = ref([
|
|
|
|
{ name: 'useNew', func: useNew },
|
|
|
|
{ name: 'useNew', func: useNew },
|
|
|
|
{ name: 'useChangeThis', func: useChangeThis },
|
|
|
|
{ name: 'useChangeThis', func: useChangeThis },
|
|
|
|
{ name: 'useDeepClone', func: useDeepClone },
|
|
|
|
{ name: 'useDeepClone', func: useDeepClone },
|
|
|
|
|
|
|
|
{ name: 'useVue3Computed', func: useVue3Computed },
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|