Jelajahi Sumber

fix: element-plus类型定义有问题,通过显式any绕过ts类型校验。

Jinyao 5 tahun lalu
induk
melakukan
55114b9a07
2 mengubah file dengan 7 tambahan dan 20 penghapusan
  1. 6 19
      src/components/TaskDrawerContent.vue
  2. 1 1
      src/main.ts

+ 6 - 19
src/components/TaskDrawerContent.vue

@@ -64,15 +64,7 @@
         <div class="detail-row">
           <span>状态:</span>
           <div  v-if="!isEditing.state"   @click="editEntry('state')" class="detail-value">
-            <template v-if="state === '已创建'">
-              <ElTag type="primary">{{state}}</ElTag>
-            </template>
-            <template v-if="state ==='进行中'">
-              <ElTag type="success">{{state}}</ElTag>
-            </template>
-            <template v-if="state ==='已完成'">
-              <ElTag type="info">{{state}}</ElTag>
-            </template>
+            <StateTag :state="state"></StateTag>
             <div class="edit-icon" />
           </div>
           <div v-else>
@@ -102,15 +94,7 @@
         <div class="detail-row">
           <span>优先级:</span>
           <div class="detail-value"  v-if="!isEditing.priority"   @click="editEntry('priority')">
-            <template v-if="priority === '紧急'">
-              <ElTag type="warning">{{priority}}</ElTag>
-            </template>
-            <template v-else-if="priority === '一般'">
-              <ElTag>{{priority}}</ElTag>
-            </template>
-            <template v-else-if="priority === '宽松'">
-              <ElTag type="success">{{priority}}</ElTag>
-            </template>
+            <PriorityTag :priority="priority"></PriorityTag>
             <div class="edit-icon" />
           </div>
           <div v-else>
@@ -229,10 +213,13 @@
 </template>
 
 <script>
-import { RequirementAPI } from '../api';
+import { RequirementAPI } from '@/api';
+import PriorityTag from '@/components/PriorityTag.vue';
+import StateTag from '@/components/StateTag.vue';
 
 export default {
   name: 'TaskDrawerContent',
+  components: { PriorityTag, StateTag },
   props: {
     id: Number,
     type: String,

+ 1 - 1
src/main.ts

@@ -13,7 +13,7 @@ Components.forEach((component) => {
   app.component(component.name, component);
 });
 
-Plugins.forEach((plugin) => {
+Plugins.forEach((plugin: any) => {
   app.use(plugin);
 });