'admin-21.05.04:修复ts的interface类型声明及引用报错问题'

This commit is contained in:
lyt-Top 2021-05-04 20:51:36 +08:00
parent 6e99cdee7d
commit 37e3db50b6
9 changed files with 21 additions and 8 deletions

View File

@ -47,7 +47,7 @@
"sass": "^1.32.12",
"sass-loader": "^11.0.1",
"typescript": "^4.2.4",
"vite": "^2.2.3",
"vite": "^2.2.4",
"vue-eslint-parser": "^7.6.0"
}
}

View File

@ -1,5 +1,6 @@
import { InjectionKey } from 'vue';
import { createStore, useStore as baseUseStore, Store } from 'vuex';
import { RootStateTypes } from '/@/store/interface/index';
import themeConfig from '/@/store/modules/themeConfig.ts';
import routesList from '/@/store/modules/routesList.ts';
import keepAliveNames from '/@/store/modules/keepAliveNames.ts';

View File

@ -1,7 +1,7 @@
// 接口类型声明
// 布局配置
declare interface ThemeConfigState {
export interface ThemeConfigState {
themeConfig: {
isDrawer: boolean;
primary: string;
@ -52,32 +52,32 @@ declare interface ThemeConfigState {
}
// 路由列表
declare interface RoutesListState {
export interface RoutesListState {
routesList: Array<object>;
}
// 路由缓存列表
declare interface KeepAliveNamesState {
export interface KeepAliveNamesState {
keepAliveNames: Array<string>;
}
// TagsView 路由列表
declare interface TagsViewRoutesState {
export interface TagsViewRoutesState {
tagsViewRoutes: Array<object>;
}
// 用户信息
declare interface UserInfosState {
export interface UserInfosState {
userInfos: object;
}
// 后端返回原始路由(未处理时)
declare interface RequestOldRoutesState {
export interface RequestOldRoutesState {
requestOldRoutes: Array<object>;
}
// 主接口(顶级类型声明)
declare interface RootStateTypes {
export interface RootStateTypes {
themeConfig: ThemeConfigState;
routesList: RoutesListState;
keepAliveNames: KeepAliveNamesState;

View File

@ -1,4 +1,6 @@
import { Module } from 'vuex';
// 此处加上 `.ts` 后缀报错,具体原因不详
import { KeepAliveNamesState, RootStateTypes } from '/@/store/interface/index';
const keepAliveNamesModule: Module<KeepAliveNamesState, RootStateTypes> = {
namespaced: true,

View File

@ -1,4 +1,6 @@
import { Module } from 'vuex';
// 此处加上 `.ts` 后缀报错,具体原因不详
import { RequestOldRoutesState, RootStateTypes } from '/@/store/interface/index';
const requestOldRoutesModule: Module<RequestOldRoutesState, RootStateTypes> = {
namespaced: true,

View File

@ -1,4 +1,6 @@
import { Module } from 'vuex';
// 此处加上 `.ts` 后缀报错,具体原因不详
import { RoutesListState, RootStateTypes } from '/@/store/interface/index';
const routesListModule: Module<RoutesListState, RootStateTypes> = {
namespaced: true,

View File

@ -1,4 +1,6 @@
import { Module } from 'vuex';
// 此处加上 `.ts` 后缀报错,具体原因不详
import { TagsViewRoutesState, RootStateTypes } from '/@/store/interface/index';
const tagsViewRoutesModule: Module<TagsViewRoutesState, RootStateTypes> = {
namespaced: true,

View File

@ -1,4 +1,6 @@
import { Module } from 'vuex';
// 此处加上 `.ts` 后缀报错,具体原因不详
import { ThemeConfigState, RootStateTypes } from '/@/store/interface/index';
const themeConfigModule: Module<ThemeConfigState, RootStateTypes> = {
namespaced: true,

View File

@ -1,5 +1,7 @@
import { Module } from 'vuex';
import { getSession } from '/@/utils/storage.ts';
// 此处加上 `.ts` 后缀报错,具体原因不详
import { UserInfosState, RootStateTypes } from '/@/store/interface/index';
const userInfosModule: Module<UserInfosState, RootStateTypes> = {
namespaced: true,