refactor: 移除defineEmits和defineProps内置宏的引入

This commit is contained in:
郝先瑞
2022-01-01 16:09:42 +08:00
parent 28d1d37b23
commit fa0491c484
7 changed files with 12 additions and 16 deletions

View File

@@ -20,7 +20,7 @@
</template>
<script setup>
import {defineEmits, ref} from "vue";
import { ref} from "vue";
import SvgIcon from '@/components/SvgIcon/index.vue';
let icons = []

View File

@@ -14,7 +14,7 @@
</template>
<script setup>
import {computed,defineProps,defineEmits} from "vue";
import {computed} from "vue";
import {scrollTo} from '@/utils/scroll-to'
const props=defineProps({

View File

@@ -29,7 +29,7 @@
</template>
<script setup>
import {defineEmits, ref, getCurrentInstance ,nextTick,onMounted,computed,watch} from "vue";
import {ref, getCurrentInstance ,nextTick,onMounted,computed,watch} from "vue";
const { proxy } = getCurrentInstance();
const state = defineProps({

View File

@@ -45,19 +45,15 @@ import {tagsViewStoreHook} from '@/store/modules/tagsView'
import {usePermissionStoreHook} from '@/store/modules/Permission'
import path from 'path-browserify'
import {
defineComponent,
computed,
getCurrentInstance,
nextTick,
onBeforeMount,
reactive,
ref,
toRefs,
watch,
onMounted
} from "vue";
import {RouteRecordRaw, useRoute, useRouter} from 'vue-router'
import {TagView} from "@store/interface";
import {TagView} from "@/store/interface";
import ScrollPane from './ScrollPane.vue'
import {Close} from '@element-plus/icons'
@@ -114,12 +110,12 @@ function filterAffixTags(routes: RouteRecordRaw[], basePath = '/') {
}
function initTags() {
const res = filterAffixTags(routes.value)
const res = filterAffixTags(routes.value) as []
affixTags.value = res
for (const tag of res) {
// Must have tag name
if (tag.name) {
tagsViewStoreHook().addVisitedView(tag as TagView)
if ((tag as TagView).name) {
tagsViewStoreHook().addVisitedView(tag)
}
}
}
@@ -159,7 +155,7 @@ function isAffix(tag: TagView) {
function isFirstView() {
try {
return selectedTag.value.fullPath === visitedViews.value[1].fullPath || selectedTag.value.fullPath === '/index'
return (selectedTag.value as TagView).fullPath === visitedViews.value[1].fullPath || (selectedTag.value as TagView).fullPath === '/index'
} catch (err) {
return false
}
@@ -167,7 +163,7 @@ function isFirstView() {
function isLastView() {
try {
return selectedTag.value.fullPath === visitedViews.value[visitedViews.value.length - 1].fullPath
return (selectedTag.value as TagView).fullPath === visitedViews.value[visitedViews.value.length - 1].fullPath
} catch (err) {
return false
}

View File

@@ -169,7 +169,7 @@
import {listTableMenus, getMenuDetail, listTreeSelectMenus, addMenu, deleteMenus, updateMenu} from "@/api/system/menu";
import {Search, Plus, Edit, Refresh, Delete} from '@element-plus/icons'
import {ElForm, ElMessage, ElMessageBox} from "element-plus";
import {defineEmits, reactive, ref, unref, onMounted} from "vue";
import { reactive, ref, unref, onMounted} from "vue";
import SvgIcon from '@/components/SvgIcon/index.vue';
import TreeSelect from '@/components/TreeSelect/index.vue';
import IconSelect from '@/components/IconSelect/index.vue';

View File

@@ -32,7 +32,7 @@
<script setup lang="ts">
import {listTreeSelectMenus} from "@/api/system/menu";
import {listRoleMenuIds, updateRoleMenu} from "@/api/system/role"
import {defineEmits, defineProps, nextTick, onMounted, reactive, ref, toRefs, watch} from "vue"
import { nextTick, onMounted, reactive, ref, toRefs, watch} from "vue"
import {ElTree, ElMessage, ElMessageBox} from "element-plus"
import {Switch, Check} from '@element-plus/icons'

View File

@@ -43,7 +43,7 @@
<script setup lang="ts">
import {listPerms} from "@/api/system/perm";
import {listRolePerms, saveRolePerms} from "@/api/system/role";
import {defineProps, onMounted, reactive, toRefs, watch} from "vue";
import { onMounted, reactive, toRefs, watch} from "vue";
import {ElMessage} from "element-plus";
import {Check} from '@element-plus/icons'