feat: 重构 Design 组件
- 移除了未使用的 CSS 样式 -优化了组件的导入方式 - 调整了 Store 的引用 - 清理了不必要的注释
This commit is contained in:
@@ -35,29 +35,13 @@
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import { defineAsyncComponent, ref, onMounted } from 'vue';
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { useCounterStore } from '@/stores/counter';
|
||||
import { storeToRefs } from 'pinia';
|
||||
// 获取 Store 实例
|
||||
const counterStore = useCounterStore();
|
||||
// 修改访问方式
|
||||
const store = storeToRefs(counterStore);
|
||||
// import 组件
|
||||
const Draggable = defineAsyncComponent(() => {
|
||||
return import('./components/Draggable.vue');
|
||||
});
|
||||
const BaseSelect = defineAsyncComponent(() => {
|
||||
return import('./components/Questions/BaseSelect.vue');
|
||||
});
|
||||
const ChooseQuestion = defineAsyncComponent(() => {
|
||||
return import('./components/ChooseQuestion.vue');
|
||||
});
|
||||
const Paging = defineAsyncComponent(() => {
|
||||
return import('./components/Questions/paging/Paging.vue');
|
||||
});
|
||||
|
||||
const chooseQuestionId = ref('');
|
||||
const questionInfo = ref(storeToRefs(counterStore).questionsInfo);
|
||||
import Draggable from './components/Draggable.vue';
|
||||
import BaseSelect from './components/Questions/BaseSelect.vue';
|
||||
import ChooseQuestion from './components/ChooseQuestion.vue';
|
||||
import Paging from './components/Questions/paging/Paging.vue';
|
||||
/**
|
||||
* 工具函数
|
||||
*/
|
||||
@@ -104,10 +88,18 @@ function util() {
|
||||
};
|
||||
}
|
||||
const { pageIsActive } = util();
|
||||
// 获取 Store 实例
|
||||
const counterStore = useCounterStore();
|
||||
const store = storeToRefs(counterStore);
|
||||
|
||||
const chooseQuestionId = ref('');
|
||||
const questionInfo = ref(store.questionsInfo.value);
|
||||
|
||||
// 获取选中的题目的ID
|
||||
const getChooseQuestionId = (questionItem) => {
|
||||
chooseQuestionId.value = questionItem.id;
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
questionInfo.value = store.questionsInfo.value;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user