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

View File

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

View File

@@ -29,7 +29,7 @@
</template> </template>
<script setup> <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 { proxy } = getCurrentInstance();
const state = defineProps({ const state = defineProps({

View File

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

View File

@@ -169,7 +169,7 @@
import {listTableMenus, getMenuDetail, listTreeSelectMenus, addMenu, deleteMenus, updateMenu} from "@/api/system/menu"; import {listTableMenus, getMenuDetail, listTreeSelectMenus, addMenu, deleteMenus, updateMenu} from "@/api/system/menu";
import {Search, Plus, Edit, Refresh, Delete} from '@element-plus/icons' import {Search, Plus, Edit, Refresh, Delete} from '@element-plus/icons'
import {ElForm, ElMessage, ElMessageBox} from "element-plus"; 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 SvgIcon from '@/components/SvgIcon/index.vue';
import TreeSelect from '@/components/TreeSelect/index.vue'; import TreeSelect from '@/components/TreeSelect/index.vue';
import IconSelect from '@/components/IconSelect/index.vue'; import IconSelect from '@/components/IconSelect/index.vue';

View File

@@ -32,7 +32,7 @@
<script setup lang="ts"> <script setup lang="ts">
import {listTreeSelectMenus} from "@/api/system/menu"; import {listTreeSelectMenus} from "@/api/system/menu";
import {listRoleMenuIds, updateRoleMenu} from "@/api/system/role" 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 {ElTree, ElMessage, ElMessageBox} from "element-plus"
import {Switch, Check} from '@element-plus/icons' import {Switch, Check} from '@element-plus/icons'

View File

@@ -43,7 +43,7 @@
<script setup lang="ts"> <script setup lang="ts">
import {listPerms} from "@/api/system/perm"; import {listPerms} from "@/api/system/perm";
import {listRolePerms, saveRolePerms} from "@/api/system/role"; 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 {ElMessage} from "element-plus";
import {Check} from '@element-plus/icons' import {Check} from '@element-plus/icons'