mirror of
https://github.com/cool-team-official/cool-admin-vue.git
synced 2025-12-14 06:42:51 +00:00
优化
This commit is contained in:
parent
382fe31d27
commit
97c2aa17d3
6
packages/crud/index.d.ts
vendored
6
packages/crud/index.d.ts
vendored
@ -632,6 +632,12 @@ declare namespace ClForm {
|
|||||||
changeTab(value: any, valid?: boolean): Promise<any>;
|
changeTab(value: any, valid?: boolean): Promise<any>;
|
||||||
setTitle(value: string): void;
|
setTitle(value: string): void;
|
||||||
submit(cb?: (data: obj) => void): void;
|
submit(cb?: (data: obj) => void): void;
|
||||||
|
Tabs: {
|
||||||
|
active: RefData<string>;
|
||||||
|
list: ClFormTabs.labels;
|
||||||
|
change(value: any, valid?: boolean): Promise<any>;
|
||||||
|
[key: string]: any;
|
||||||
|
};
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { defineComponent, h, nextTick, } from "vue";
|
import { defineComponent, h, nextTick } from "vue";
|
||||||
import { assign, cloneDeep, isBoolean, isFunction, keys } from "lodash-es";
|
import { assign, cloneDeep, isBoolean, isFunction, keys } from "lodash-es";
|
||||||
import { useAction, useForm, usePlugins, useTabs } from "./helper";
|
import { useAction, useForm, usePlugins, useTabs } from "./helper";
|
||||||
import { useBrowser, useConfig, useElApi, useRefs } from "../../hooks";
|
import { useBrowser, useConfig, useElApi, useRefs } from "../../hooks";
|
||||||
@ -16,7 +16,7 @@ export default defineComponent({
|
|||||||
enablePlugin: {
|
enablePlugin: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
setup(props, { expose, slots }) {
|
setup(props, { expose, slots }) {
|
||||||
@ -39,7 +39,14 @@ export default defineComponent({
|
|||||||
|
|
||||||
// 方法
|
// 方法
|
||||||
const ElFormApi = useElApi(
|
const ElFormApi = useElApi(
|
||||||
["validate", "validateField", "resetFields", "scrollToField", "clearValidate", "fields"],
|
[
|
||||||
|
"validate",
|
||||||
|
"validateField",
|
||||||
|
"resetFields",
|
||||||
|
"scrollToField",
|
||||||
|
"clearValidate",
|
||||||
|
"fields"
|
||||||
|
],
|
||||||
Form
|
Form
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -291,7 +298,7 @@ export default defineComponent({
|
|||||||
if (e.required) {
|
if (e.required) {
|
||||||
e.rules = {
|
e.rules = {
|
||||||
required: true,
|
required: true,
|
||||||
message: dict.label.nonEmpty.replace('{label}', e.label || '')
|
message: dict.label.nonEmpty.replace("{label}", e.label || "")
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -635,9 +642,7 @@ export default defineComponent({
|
|||||||
Tabs,
|
Tabs,
|
||||||
...Action,
|
...Action,
|
||||||
...ElFormApi
|
...ElFormApi
|
||||||
}
|
};
|
||||||
|
|
||||||
// console.log(ctx)
|
|
||||||
|
|
||||||
expose(ctx);
|
expose(ctx);
|
||||||
|
|
||||||
|
|||||||
14
packages/vite-plugin/dist/index.js
vendored
14
packages/vite-plugin/dist/index.js
vendored
@ -307,18 +307,20 @@
|
|||||||
*/
|
*/
|
||||||
function getNodes(code) {
|
function getNodes(code) {
|
||||||
const nodes = [];
|
const nodes = [];
|
||||||
const templateMatch = /<template>([\s\S]*?)<\/template>/g.exec(code);
|
const templateRegex = /<template[^>]*>([\s\S]*?)<\/template>/g;
|
||||||
if (!templateMatch) {
|
let templateMatch;
|
||||||
return nodes;
|
// 找到所有的 template 标签内容
|
||||||
}
|
while ((templateMatch = templateRegex.exec(code)) !== null) {
|
||||||
const templateContent = templateMatch[1];
|
const templateContent = templateMatch[1];
|
||||||
const regex = /<([^>]+)>/g;
|
const regex = /<([^>]+)>/g;
|
||||||
let match;
|
let match;
|
||||||
|
// 提取每个 template 中的所有标签
|
||||||
while ((match = regex.exec(templateContent)) !== null) {
|
while ((match = regex.exec(templateContent)) !== null) {
|
||||||
if (!match[1].startsWith("/")) {
|
if (!match[1].startsWith("/")) {
|
||||||
nodes.push(match[1]);
|
nodes.push(match[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return nodes.map((e) => `<${e}>`);
|
return nodes.map((e) => `<${e}>`);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -1676,6 +1678,10 @@ if (typeof window !== 'undefined') {
|
|||||||
return {
|
return {
|
||||||
// 处理选择器规则
|
// 处理选择器规则
|
||||||
Rule(rule) {
|
Rule(rule) {
|
||||||
|
if (rule.selector.includes("uni-") ||
|
||||||
|
[".button-hover"].some((e) => rule.selector.includes(e))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// 转换选择器为安全的类名格式
|
// 转换选择器为安全的类名格式
|
||||||
rule.selector = toSafeClass(rule.selector.replace(/\\/g, ""));
|
rule.selector = toSafeClass(rule.selector.replace(/\\/g, ""));
|
||||||
},
|
},
|
||||||
|
|||||||
@ -112,6 +112,15 @@ function postcssPlugin(): Plugin {
|
|||||||
return {
|
return {
|
||||||
// 处理选择器规则
|
// 处理选择器规则
|
||||||
Rule(rule: any) {
|
Rule(rule: any) {
|
||||||
|
if (
|
||||||
|
rule.selector.includes("uni-") ||
|
||||||
|
[".button-hover"].some((e) =>
|
||||||
|
rule.selector.includes(e),
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// 转换选择器为安全的类名格式
|
// 转换选择器为安全的类名格式
|
||||||
rule.selector = toSafeClass(
|
rule.selector = toSafeClass(
|
||||||
rule.selector.replace(/\\/g, ""),
|
rule.selector.replace(/\\/g, ""),
|
||||||
|
|||||||
@ -98,21 +98,22 @@ export function getClassContent(html: string) {
|
|||||||
*/
|
*/
|
||||||
export function getNodes(code: string) {
|
export function getNodes(code: string) {
|
||||||
const nodes: string[] = [];
|
const nodes: string[] = [];
|
||||||
const templateMatch = /<template>([\s\S]*?)<\/template>/g.exec(code);
|
const templateRegex = /<template[^>]*>([\s\S]*?)<\/template>/g;
|
||||||
|
let templateMatch;
|
||||||
if (!templateMatch) {
|
|
||||||
return nodes;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// 找到所有的 template 标签内容
|
||||||
|
while ((templateMatch = templateRegex.exec(code)) !== null) {
|
||||||
const templateContent = templateMatch[1];
|
const templateContent = templateMatch[1];
|
||||||
const regex = /<([^>]+)>/g;
|
const regex = /<([^>]+)>/g;
|
||||||
let match;
|
let match;
|
||||||
|
|
||||||
|
// 提取每个 template 中的所有标签
|
||||||
while ((match = regex.exec(templateContent)) !== null) {
|
while ((match = regex.exec(templateContent)) !== null) {
|
||||||
if (!match[1].startsWith("/")) {
|
if (!match[1].startsWith("/")) {
|
||||||
nodes.push(match[1]);
|
nodes.push(match[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return nodes.map((e) => `<${e}>`);
|
return nodes.map((e) => `<${e}>`);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user