惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

W
WeLiveSecurity
T
The Exploit Database - CXSecurity.com
C
CXSECURITY Database RSS Feed - CXSecurity.com
S
Security @ Cisco Blogs
T
Threat Research - Cisco Blogs
TaoSecurity Blog
TaoSecurity Blog
Recent Commits to openclaw:main
Recent Commits to openclaw:main
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
腾讯CDC
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
T
The Blog of Author Tim Ferriss
Microsoft Azure Blog
Microsoft Azure Blog
罗磊的独立博客
F
Full Disclosure
博客园 - 【当耐特】
C
CERT Recently Published Vulnerability Notes
Engineering at Meta
Engineering at Meta
Application and Cybersecurity Blog
Application and Cybersecurity Blog
T
Threatpost
I
Intezer
V2EX - 技术
V2EX - 技术
H
Hackread – Cybersecurity News, Data Breaches, AI and More
The Hacker News
The Hacker News
小众软件
小众软件
Google DeepMind News
Google DeepMind News
T
Tailwind CSS Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
B
Blog RSS Feed
Microsoft Security Blog
Microsoft Security Blog
N
News | PayPal Newsroom
MyScale Blog
MyScale Blog
AI
AI
Vercel News
Vercel News
Spread Privacy
Spread Privacy
美团技术团队
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
The GitHub Blog
The GitHub Blog
V
Vulnerabilities – Threatpost
Schneier on Security
Schneier on Security
Cyberwarzone
Cyberwarzone
G
GRAHAM CLULEY
Help Net Security
Help Net Security
Hacker News: Ask HN
Hacker News: Ask HN
Google DeepMind News
Google DeepMind News
MongoDB | Blog
MongoDB | Blog
L
LINUX DO - 热门话题
U
Unit 42
L
LangChain Blog
Recent Announcements
Recent Announcements

卖坚果的怪叔叔

上线8年,15万用户的小程序,一共赚了多少钱? 糟糕的三月 还未见面的小狗,去天堂了。 快过年了!你们放假通知下来了吗? 免费领取一年Gemini Pro使用权益!! 2025年,如梦一场! 西安! WordPress评论留言通知推送插件! 初冬!暖日!东太湖慢行! H5在safari上fixed不触底bug? 2025年国庆的一些记录! 秋末的晚上 我用Trae做了一个一键同步热点要闻到公众号的工具 Nuxt3中的水合是什么?以及使用中的一些总结! Element Plus Upload 添加支持拖拽排序~ 夏日的周末! 腾讯视频VIP会员免费领取!3-31天。 七月已经到中旬了呀 周末了,但也过得太快了吧。 吐血收集的1000+九号电动车提示音,免费领取! Nuxt3中piana持久化处理! 生活中的突发事件 小毛驴历险记2 小毛驴历险记 QQ,你有多久没有打开啦! npm install 出现 Error:EISDIR:illegal operation on a directory 的错误提示! 最近为啥没更新? 是过年呀 PC微信多开和防撤回~ 好险!我差点被诈骗了~
使用uview-plus遇到的一些问题!
坚果大叔 2025-09-19 20:21:59技术阅读 2,844 · 2025-09-19 · via 卖坚果的怪叔叔

一开始使用的版本是3.3.64,因为看官网文档中有些组件是3.4.68才支持的,之前的版本没有这个功能,然后就把版本升级了一下,结果带来了以为问题。因为在官方文档中并没有说明,所以如果有遇到相同问题的可以参考解决一下。

第一个问题css语法问题

因为项目中开了TS严格模式,在编译成app的时候提示如下CSS语法错误,但是只是警告不是ERROR。实际上是可以忽略的。

使用uview-plus遇到的一些问题!-卖坚果的怪叔叔

20:41:29.534     node_modules\uview-plus\components\u-coupon\u-coupon.vue 111:9  root stylesheet 
20:41:29.534 DEPRECATION WARNING: Sass's behavior for declarations that appear after nested 
20:41:29.534 rules will be changing to match the behavior specified by CSS in an upcoming 
20:41:29.534 version. To keep the existing behavior, move the declaration above the nested

上面的width:100%位置会导致CSS检查报错,将它移动到最顶端就可以了。

第二个问题:富文本组件的事件丢失

在上一个版本中用的好好的,更新最新版本后,点击图片事件丢失。出现如下emit错误。查看源码后发现判断更改,注册事件变动。emit暴露方法旨在鸿蒙中生效,H5上没有用了。

解决办法

修改注册判断以及将emit事件暴露出去。

     this.$nextTick(() => {
-      // 修复可能导致死循环的问题
-      for (this.root = this?.$parent; this.root && this.root?.$options.name !== 'mp-html'; this.root = this.root?.$parent);
+      for (this.root = this.$parent; this.root.$options.name !== 'u-parse'; this.root = this.root.$parent);
     })
   // #ifdef H5 || APP-PLUS
   node.attrs.src = node.attrs.src || node.attrs['data-src']
   // #endif
+  console.log('imgTap', node.attrs)
+  this.root.$emit('imgTap', node.attrs)
   // #ifndef APP-HARMONY
   this.root.$emit('imgtap', node.attrs)
   // #endif

第三个问题,上传组件限制只能上传9张

在使用上传组件的时候发现一个问题,只能上传9张,不管是app还是H5上面。之前没有发现是因为在微信中打开H5系统的选择图片最多选择9张。后来用H5就算你选了20张也只给你上传9张。一开始还以为是手机系统原因。然后就去看了源码,如下:

uni.chooseImage({
    count: multiple ? Math.min(maxCount, 9) : 1,
    sourceType: capture,
    sizeType,
    success: (res) => resolve(formatImage(res)),
    fail: reject
})

当你设置了可以多选的时候,默认取始终取的是最小值9,大无语呀!所以如果你需要上传实际选择的图片可以直接把macCount做为参数就行了。

以上问题在修改后通过patch补丁的方式来进行修改,如果有遇到相同问题的小伙伴可以使用同样是解决方式!

pnpm patch的工作流程

1. 生成临时目录
pnpm patch uview-plus

#输出类似:这个目录是 uview-plus的完整副本,可以直接修改。
You can now edit the following folder: /tmp/abc123
2. 修改代码
cd /tmp/abc123
code components/u-coupon/u-coupon.vue# 修改文件
3. 生成补丁
pnpm patch-commit /tmp/abc123

# 在 patches/目录下生成补丁文件(如 uview-plus@3.5.41.patch)
# 自动在 package.json中添加 pnpm.patchedDependencies配置
4. 重新安装验证
rm -rf node_modules
pnpm install