mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-06-04 07:27:41 +08:00
fix: 修复使用this
语法时无法显示代码提示的问题并更新pinia
相关语法
This commit is contained in:
parent
b843eda26f
commit
f8690a0b73
@ -90,9 +90,9 @@ export default defineComponent({
|
|||||||
];
|
];
|
||||||
// 取得每一层的当前节点是不是在当前层级列表的最后一个
|
// 取得每一层的当前节点是不是在当前层级列表的最后一个
|
||||||
const lastnodeArr = [];
|
const lastnodeArr = [];
|
||||||
let currentNode = this.node;
|
let currentNode: any = this.node;
|
||||||
while (currentNode) {
|
while (currentNode) {
|
||||||
let parentNode = currentNode.parent;
|
let parentNode: any = currentNode.parent;
|
||||||
// 兼容element-plus的 el-tree-v2 (Virtualized Tree 虚拟树)
|
// 兼容element-plus的 el-tree-v2 (Virtualized Tree 虚拟树)
|
||||||
if (currentNode.level === 1 && !currentNode.parent) {
|
if (currentNode.level === 1 && !currentNode.parent) {
|
||||||
// el-tree-v2的第一层node是没有parent的,必需 treeData 创建一个parent
|
// el-tree-v2的第一层node是没有parent的,必需 treeData 创建一个parent
|
||||||
|
@ -8,8 +8,7 @@ import {
|
|||||||
responsiveStorageNameSpace
|
responsiveStorageNameSpace
|
||||||
} from "../utils";
|
} from "../utils";
|
||||||
|
|
||||||
export const useAppStore = defineStore({
|
export const useAppStore = defineStore("pure-app", {
|
||||||
id: "pure-app",
|
|
||||||
state: (): appType => ({
|
state: (): appType => ({
|
||||||
sidebar: {
|
sidebar: {
|
||||||
opened:
|
opened:
|
||||||
|
@ -6,8 +6,7 @@ import {
|
|||||||
responsiveStorageNameSpace
|
responsiveStorageNameSpace
|
||||||
} from "../utils";
|
} from "../utils";
|
||||||
|
|
||||||
export const useEpThemeStore = defineStore({
|
export const useEpThemeStore = defineStore("pure-epTheme", {
|
||||||
id: "pure-epTheme",
|
|
||||||
state: () => ({
|
state: () => ({
|
||||||
epThemeColor:
|
epThemeColor:
|
||||||
storageLocal().getItem<StorageConfigs>(
|
storageLocal().getItem<StorageConfigs>(
|
||||||
|
@ -14,8 +14,7 @@ import {
|
|||||||
} from "../utils";
|
} from "../utils";
|
||||||
import { usePermissionStoreHook } from "./permission";
|
import { usePermissionStoreHook } from "./permission";
|
||||||
|
|
||||||
export const useMultiTagsStore = defineStore({
|
export const useMultiTagsStore = defineStore("pure-multiTags", {
|
||||||
id: "pure-multiTags",
|
|
||||||
state: () => ({
|
state: () => ({
|
||||||
// 存储标签页信息(路由信息)
|
// 存储标签页信息(路由信息)
|
||||||
multiTags: storageLocal().getItem<StorageConfigs>(
|
multiTags: storageLocal().getItem<StorageConfigs>(
|
||||||
@ -24,12 +23,12 @@ export const useMultiTagsStore = defineStore({
|
|||||||
? storageLocal().getItem<StorageConfigs>(
|
? storageLocal().getItem<StorageConfigs>(
|
||||||
`${responsiveStorageNameSpace()}tags`
|
`${responsiveStorageNameSpace()}tags`
|
||||||
)
|
)
|
||||||
: [
|
: ([
|
||||||
...routerArrays,
|
...routerArrays,
|
||||||
...usePermissionStoreHook().flatteningRoutes.filter(
|
...usePermissionStoreHook().flatteningRoutes.filter(
|
||||||
v => v?.meta?.fixedTag
|
v => v?.meta?.fixedTag
|
||||||
)
|
)
|
||||||
],
|
] as any),
|
||||||
multiTagsCache: storageLocal().getItem<StorageConfigs>(
|
multiTagsCache: storageLocal().getItem<StorageConfigs>(
|
||||||
`${responsiveStorageNameSpace()}configure`
|
`${responsiveStorageNameSpace()}configure`
|
||||||
)?.multiTagsCache
|
)?.multiTagsCache
|
||||||
|
@ -12,8 +12,7 @@ import {
|
|||||||
} from "../utils";
|
} from "../utils";
|
||||||
import { useMultiTagsStoreHook } from "./multiTags";
|
import { useMultiTagsStoreHook } from "./multiTags";
|
||||||
|
|
||||||
export const usePermissionStore = defineStore({
|
export const usePermissionStore = defineStore("pure-permission", {
|
||||||
id: "pure-permission",
|
|
||||||
state: () => ({
|
state: () => ({
|
||||||
// 静态路由生成的菜单
|
// 静态路由生成的菜单
|
||||||
constantMenus,
|
constantMenus,
|
||||||
@ -31,7 +30,7 @@ export const usePermissionStore = defineStore({
|
|||||||
filterTree(ascending(this.constantMenus.concat(routes)))
|
filterTree(ascending(this.constantMenus.concat(routes)))
|
||||||
);
|
);
|
||||||
this.flatteningRoutes = formatFlatteningRoutes(
|
this.flatteningRoutes = formatFlatteningRoutes(
|
||||||
this.constantMenus.concat(routes)
|
this.constantMenus.concat(routes) as any
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
cacheOperate({ mode, name }: cacheType) {
|
cacheOperate({ mode, name }: cacheType) {
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import { type setType, store, getConfig } from "../utils";
|
import { type setType, store, getConfig } from "../utils";
|
||||||
|
|
||||||
export const useSettingStore = defineStore({
|
export const useSettingStore = defineStore("pure-setting", {
|
||||||
id: "pure-setting",
|
|
||||||
state: (): setType => ({
|
state: (): setType => ({
|
||||||
title: getConfig().Title,
|
title: getConfig().Title,
|
||||||
fixedHeader: getConfig().FixedHeader,
|
fixedHeader: getConfig().FixedHeader,
|
||||||
|
@ -16,8 +16,7 @@ import {
|
|||||||
import { useMultiTagsStoreHook } from "./multiTags";
|
import { useMultiTagsStoreHook } from "./multiTags";
|
||||||
import { type DataInfo, setToken, removeToken, userKey } from "@/utils/auth";
|
import { type DataInfo, setToken, removeToken, userKey } from "@/utils/auth";
|
||||||
|
|
||||||
export const useUserStore = defineStore({
|
export const useUserStore = defineStore("pure-user", {
|
||||||
id: "pure-user",
|
|
||||||
state: (): userType => ({
|
state: (): userType => ({
|
||||||
// 头像
|
// 头像
|
||||||
avatar: storageLocal().getItem<DataInfo<number>>(userKey)?.avatar ?? "",
|
avatar: storageLocal().getItem<DataInfo<number>>(userKey)?.avatar ?? "",
|
||||||
|
@ -9,6 +9,7 @@ const Print = function (dom, options?: object): PrintFunction {
|
|||||||
options = options || {};
|
options = options || {};
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
if (!(this instanceof Print)) return new Print(dom, options);
|
if (!(this instanceof Print)) return new Print(dom, options);
|
||||||
|
// @ts-expect-error
|
||||||
this.conf = {
|
this.conf = {
|
||||||
styleStr: "",
|
styleStr: "",
|
||||||
// Elements that need to dynamically get and set the height
|
// Elements that need to dynamically get and set the height
|
||||||
@ -18,19 +19,26 @@ const Print = function (dom, options?: object): PrintFunction {
|
|||||||
// Callback after printing
|
// Callback after printing
|
||||||
printDoneCallBack: null
|
printDoneCallBack: null
|
||||||
};
|
};
|
||||||
|
// @ts-expect-error
|
||||||
for (const key in this.conf) {
|
for (const key in this.conf) {
|
||||||
if (key && options.hasOwnProperty(key)) {
|
if (key && options.hasOwnProperty(key)) {
|
||||||
|
// @ts-expect-error
|
||||||
this.conf[key] = options[key];
|
this.conf[key] = options[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (typeof dom === "string") {
|
if (typeof dom === "string") {
|
||||||
|
// @ts-expect-error
|
||||||
this.dom = document.querySelector(dom);
|
this.dom = document.querySelector(dom);
|
||||||
} else {
|
} else {
|
||||||
|
// @ts-expect-error
|
||||||
this.dom = this.isDOM(dom) ? dom : dom.$el;
|
this.dom = this.isDOM(dom) ? dom : dom.$el;
|
||||||
}
|
}
|
||||||
|
// @ts-expect-error
|
||||||
if (this.conf.setDomHeightArr && this.conf.setDomHeightArr.length) {
|
if (this.conf.setDomHeightArr && this.conf.setDomHeightArr.length) {
|
||||||
|
// @ts-expect-error
|
||||||
this.setDomHeight(this.conf.setDomHeightArr);
|
this.setDomHeight(this.conf.setDomHeightArr);
|
||||||
}
|
}
|
||||||
|
// @ts-expect-error
|
||||||
this.init();
|
this.init();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -4,10 +4,11 @@
|
|||||||
"module": "ESNext",
|
"module": "ESNext",
|
||||||
"moduleResolution": "bundler",
|
"moduleResolution": "bundler",
|
||||||
"strict": false,
|
"strict": false,
|
||||||
|
"strictFunctionTypes": false,
|
||||||
|
"noImplicitThis": true,
|
||||||
"jsx": "preserve",
|
"jsx": "preserve",
|
||||||
"importHelpers": true,
|
"importHelpers": true,
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"strictFunctionTypes": false,
|
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
|
1
types/global-components.d.ts
vendored
1
types/global-components.d.ts
vendored
@ -120,6 +120,7 @@ declare module "vue" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface ComponentCustomProperties {
|
interface ComponentCustomProperties {
|
||||||
|
$storage: ResponsiveStorage;
|
||||||
$message: (typeof import("element-plus"))["ElMessage"];
|
$message: (typeof import("element-plus"))["ElMessage"];
|
||||||
$notify: (typeof import("element-plus"))["ElNotification"];
|
$notify: (typeof import("element-plus"))["ElNotification"];
|
||||||
$msgbox: (typeof import("element-plus"))["ElMessageBox"];
|
$msgbox: (typeof import("element-plus"))["ElMessageBox"];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user