
Security News
New Study Identifies 53 Slopsquatting Targets Across 5 Frontier LLMs
Five frontier LLMs generated the same nonexistent package names, leaving 53 available for potential slopsquatting across PyPI and npm.
@deppon/deppon-utils
Advanced tools
@deppon/deppon-utils前端工具函数库,适用于 Vue 项目。
提供丰富的工具函数,包括:
removeClass - 移除 DOM 类名removeDom - 移除 DOM 元素insertAfter - 在元素后插入findParentDom - 查找父元素browser - 浏览器检测setTitle - 设置页面标题windowScrollTop - 获取/设置滚动位置scrollTo - 滚动到指定位置scrollToElement - 滚动到指定元素noScroll - 禁止滚动resolveIOSScroll - 解决 iOS 滚动问题debounce - 防抖throttle - 节流random - 随机数生成isPhone - 手机号验证isArray - 数组判断isObject - 对象判断isString - 字符串判断removeSpace - 移除空格lengthOfStr - 字符串长度计算splitArray - 数组分割parseUrlParams - 解析 URL 参数objectToParams - 对象转 URL 参数replcaeUrlParam - 替换 URL 参数replcaeUrlParams - 替换多个 URL 参数localUrl - 本地 URL 处理isViewTabSupported - 检查是否支持 viewTab(是否在 iframe 环境中)getParentParams - 从父级 iframe 获取参数appendUrlParam - 在 URL 后追加参数closeParentTab - 关闭父级标签页viewTab - 在 iframe 环境中打开新标签页navigate - 智能路由跳转(优先使用 viewTab,否则使用普通跳转)isUap - 判断系统是否在 UAP 环境内getCookie - 获取 CookiesetCookieDomain - 设置 document.domain 以支持 cookie 跨域copyStr - 复制字符串copyToClipboard - 复制到剪贴板preloadImage - 预加载图片Time - 时间处理queryCode - 查询代码login - 登录loginCheck - 登录检查authorize - 授权checkName - 名称检查open - 打开链接openApp - 打开 AppxDomain - 跨域处理flexible - 移动端适配limitVersion - 版本限制observerDom - DOM 观察器md5 - MD5 加密getRestTimeStr - 获取剩余时间字符串import {
viewTab,
navigate,
getParentParams,
isViewTabSupported,
appendUrlParam,
closeParentTab,
} from '@deppon/deppon-utils';
// 检查是否支持 viewTab
if (isViewTabSupported()) {
// 从父级获取参数
const params = getParentParams();
console.log('父级参数:', params);
// 打开新标签页
viewTab('产品折扣新增', '/product/discount/add', 'iframe', params, {
uumsFunction: {
functionCode: 'CMC_FUNCTION_00002',
sourceSystem: 'CMC',
},
appendIsUap: true, // 默认会在 URL 后追加 isUap=true
});
// 或者使用智能跳转(自动降级)
navigate('产品折扣新增', '/product/discount/add', 'iframe', params, {
uumsFunction: {
functionCode: 'CMC_FUNCTION_00002',
sourceSystem: 'CMC',
},
});
}
// 在 URL 后追加参数
const urlWithParam = appendUrlParam('/product/list', 'isUap=true');
// 关闭父级标签页
closeParentTab('/product/list', 'IFRAME');
// 替换原有的 top.viewTab 调用
import { viewTab, getParentParams, appendUrlParam, closeParentTab } from '@deppon/deppon-utils';
// 原有代码:
// top.viewTab && top.viewTab("CMC-产品折扣新增", url, "iframe", params, {
// uumsFunction: {
// functionCode: "CMC_FUNCTION_00002",
// sourceSystem: "CMC",
// },
// });
// 新代码:
const params = getParentParams();
viewTab('CMC-产品折扣新增', url, 'iframe', params, {
uumsFunction: {
functionCode: 'CMC_FUNCTION_00002',
sourceSystem: 'CMC',
},
});
// 如果需要先关闭标签页再打开
const tabUrl = appendUrlParam(url, 'isUap=true');
closeParentTab(tabUrl, 'IFRAME');
viewTab('CMC-产品折扣新增', url, 'iframe', params, {
uumsFunction: {
functionCode: 'CMC_FUNCTION_00002',
sourceSystem: 'CMC',
},
});
import { isUap } from '@deppon/deppon-utils';
// 判断是否在 UAP 环境中
if (isUap()) {
// UAP 环境下的逻辑
console.log('当前在 UAP 环境中');
// 隐藏头部、侧边栏等
// 使用 UAP 特定的样式
} else {
// 非 UAP 环境下的逻辑
console.log('当前不在 UAP 环境中');
// 显示完整的页面布局
}
// 在 Vue 组件中使用
export default {
data() {
return {
isUapEnv: isUap(),
};
},
mounted() {
if (this.isUapEnv) {
// UAP 环境初始化逻辑
}
},
};
UAP 环境判断逻辑:
isUap=true(支持 query 和 hash 模式)viewTab 或 Ext使用场景:
import { setCookieDomain } from '@deppon/deppon-utils';
// 在应用初始化时调用,自动设置 document.domain 以支持 cookie 跨域
setCookieDomain();
// 在 Vue 应用中使用
import { createApp } from 'vue';
import { setCookieDomain } from '@deppon/deppon-utils';
const app = createApp(App);
setCookieDomain(); // 在应用创建时调用
app.mount('#app');
设置逻辑:
deppontest.com,自动设置 document.domain = 'deppontest.com'deppon.com,自动设置 document.domain = 'deppon.com'注意事项:
document.domain 只能在当前域或其父域上设置document.domain 后,端口号会被忽略FAQs
Frontend utility functions
The npm package @deppon/deppon-utils receives a total of 5,299 weekly downloads. As such, @deppon/deppon-utils popularity was classified as popular.
We found that @deppon/deppon-utils demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Five frontier LLMs generated the same nonexistent package names, leaving 53 available for potential slopsquatting across PyPI and npm.

Security News
The White House’s Gold Eagle Initiative aims to coordinate AI-discovered vulnerabilities, validate findings, and accelerate patching across critical software.

Security News
A Shai-Hulud infection exposed Suno's source code, which shows the AI music startup stream-ripped tracks to train its models.