v1.2.0 bug修复
This commit is contained in:
@@ -164,6 +164,12 @@ export default {
|
||||
return
|
||||
}
|
||||
|
||||
// 验证每个路径是否以/开头
|
||||
const invalidPaths = pathArray.filter(path => !path.startsWith('/'));
|
||||
if (invalidPaths.length > 0) {
|
||||
this.$message.error(`路径必须以 / 开头: ${invalidPaths.join(', ')}`);
|
||||
return
|
||||
}
|
||||
|
||||
if (this.addParams.buttonContent) {
|
||||
// 兼容中英文逗号分割
|
||||
@@ -187,14 +193,6 @@ export default {
|
||||
|
||||
}
|
||||
|
||||
// 验证每个路径是否有效
|
||||
const invalidPaths = pathArray.filter(path => !isValidPath(path));
|
||||
if (invalidPaths.length > 0) {
|
||||
const suggestions = getPathSuggestions(invalidPaths[0]);
|
||||
this.$message.error(`${this.$t("backendSystem.invalidPath")}: ${invalidPaths.join(', ')}。${this.$t("backendSystem.invalidPathSuggestions")}: ${suggestions.slice(0, 3).join(', ')}`);
|
||||
return
|
||||
}
|
||||
|
||||
// 验证通过,保持字符串格式传给后端(不转换为数组)
|
||||
// this.addParams.buttonPath 保持原始字符串格式
|
||||
}
|
||||
@@ -254,14 +252,12 @@ export default {
|
||||
return
|
||||
}
|
||||
|
||||
// 验证每个路径是否有效
|
||||
const invalidPaths = pathArray.filter(path => !isValidPath(path));
|
||||
// 验证每个路径是否以/开头
|
||||
const invalidPaths = pathArray.filter(path => !path.startsWith('/'));
|
||||
if (invalidPaths.length > 0) {
|
||||
const suggestions = getPathSuggestions(invalidPaths[0]);
|
||||
this.$message.error(`${this.$t("backendSystem.invalidPath")}: ${invalidPaths.join(', ')}。${this.$t("backendSystem.invalidPathSuggestions")}: ${suggestions.slice(0, 3).join(', ')}`);
|
||||
this.$message.error(`路径必须以 / 开头: ${invalidPaths.join(', ')}`);
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
this.$message.warning(this.$t("backendSystem.pleaseInputButtonContentAndPath"))
|
||||
@@ -363,23 +359,19 @@ export default {
|
||||
* @returns {Array} 路径建议列表
|
||||
*/
|
||||
getValidPathSuggestions() {
|
||||
return getPathSuggestions('').slice(0, 8); // 返回前8个常用路径
|
||||
// 移除路径建议,返回空数组
|
||||
return [];
|
||||
},
|
||||
|
||||
/**
|
||||
* 显示路径使用帮助
|
||||
*/
|
||||
showPathHelp() {
|
||||
const suggestions = this.getValidPathSuggestions();
|
||||
const helpMessage = `
|
||||
常用路径示例:
|
||||
${suggestions.slice(0, 10).join('\n')}
|
||||
|
||||
路径规则:
|
||||
• 多个路径用逗号分隔
|
||||
• 路径必须以 / 开头
|
||||
• 支持动态路由参数
|
||||
• 不要包含域名,只写路径部分
|
||||
• 路径格式自由,不做严格验证
|
||||
• 支持任意路径格式
|
||||
`;
|
||||
|
||||
this.$alert(helpMessage, '路径格式说明', {
|
||||
@@ -399,7 +391,7 @@ export default {
|
||||
return [];
|
||||
}
|
||||
return buttonContent
|
||||
.split(',')
|
||||
.split(/[,,]/)
|
||||
.map(btn => btn.trim())
|
||||
.filter(btn => btn);
|
||||
},
|
||||
@@ -414,7 +406,7 @@ export default {
|
||||
return [];
|
||||
}
|
||||
return buttonPath
|
||||
.split(',')
|
||||
.split(/[,,]/)
|
||||
.map(path => path.trim())
|
||||
.filter(path => path);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user