HBuilderX

HBuilderX

极客开发工具
uni-app

uni-app

开发一次,多端覆盖
uniCloud

uniCloud

云开发平台
HTML5+

HTML5+

增强HTML5的功能体验
MUI

MUI

上万Star的前端框架

如何判断当前行是否保存了代码?

atob

要判断当前行是否保存了代码,可从以下几个维度进行分析,具体方法取决于你所处的场景(如文本编辑器、代码编辑器、文档等),以下是通用判断思路:
一、从内容特征判断
语法结构识别
代码通常包含特定编程语言的语法元素,例如:
编程语言关键词(如 Python 的def、for、if;Java 的public、class、static)。
符号与格式:括号()、花括号{}、方括号[]、分号;、冒号:、运算符+、=、==等。
函数 / 方法调用(如print()、list.append())、变量定义(如int x = 5;)、代码块缩进。
示例:
python
运行
def calculate_sum(a, b):
return a + b

明显包含 Python 函数定义的语法特征,属于代码。
注释与代码标识
代码中常出现注释符号(如//、#、/ /),或被特定标记包裹(如 Markdown 中的代码块符号 ```)。
示例:

这是一行Python注释

// Java代码注释
二、从上下文场景判断
所在平台或工具
若在代码编辑器(如 VS Code、PyCharm)、IDE 或编程相关文档中,当前行更可能是代码。
若在普通文本编辑器、Word 文档或市场分析报告中(如前序对话中的大蒜价格数据),则更可能是纯文本。
前后文关联
查看当前行的上下文:
若前后文有代码块、编程术语(如 “函数”“变量”“循环”),则当前行可能是代码的一部分。
若前后文为自然语言描述(如市场行情、操作步骤),则更可能是普通文本。
三、特殊场景的判断技巧
Markdown 或文档中的代码块
若当前行被 ``或 包裹(如代码块标记),则属于代码。
示例:
java
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World");
}
}

纯文本中的代码片段
即使没有标记,若内容符合编程语言语法(如一行 SQL 语句、HTML 标签),也属于代码。
示例:
SELECT * FROM users WHERE age > 18;(SQL 代码)
<div class="container">内容</div>(HTML 代码)
四、总结:判断流程
看内容:是否包含编程语言关键词、符号、语法结构。
看标记:是否被代码块符号包裹,或有注释符号。
看场景:是否在编程相关工具或上下文中。
若满足以上任意一点,当前行更可能是代码;若内容为自然语言、数据列表或非结构化文本,则不是代码。

https://q.yingjiesheng.com/forum/bk25786/tz1125678
https://q.yingjiesheng.com/forum/bk25786/tz1125679
https://q.yingjiesheng.com/forum/bk25786/tz1125680
https://q.yingjiesheng.com/forum/bk25786/tz1125681
https://q.yingjiesheng.com/forum/bk25786/tz1125682
https://q.yingjiesheng.com/forum/bk25786/tz1125683
https://q.yingjiesheng.com/forum/bk25786/tz1125684
https://q.yingjiesheng.com/forum/bk25786/tz1125685
https://q.yingjiesheng.com/forum/bk25786/tz1125686
https://q.yingjiesheng.com/forum/bk25786/tz1125688
https://q.yingjiesheng.com/forum/bk25786/tz1125690
https://q.yingjiesheng.com/forum/bk25786/tz1125691
https://q.yingjiesheng.com/forum/bk25786/tz1125692
https://q.yingjiesheng.com/forum/bk25786/tz1125693
https://q.yingjiesheng.com/forum/bk25786/tz1125694
https://q.yingjiesheng.com/forum/bk25786/tz1125695
https://q.yingjiesheng.com/forum/bk25786/tz1125696
https://q.yingjiesheng.com/forum/bk25786/tz1125697
https://q.yingjiesheng.com/forum/bk25786/tz1125698
https://q.yingjiesheng.com/forum/bk25786/tz1125699
https://q.yingjiesheng.com/forum/bk25786/tz1125700
https://q.yingjiesheng.com/forum/bk25786/tz1125701
https://q.yingjiesheng.com/forum/bk25786/tz1125702
https://q.yingjiesheng.com/forum/bk25786/tz1125703
https://q.yingjiesheng.com/forum/bk25786/tz1125704
https://q.yingjiesheng.com/forum/bk25786/tz1125705
https://q.yingjiesheng.com/forum/bk25786/tz1125706
https://q.yingjiesheng.com/forum/bk25786/tz1125707
https://q.yingjiesheng.com/forum/bk25786/tz1125708
https://q.yingjiesheng.com/forum/bk25786/tz1125709
https://q.yingjiesheng.com/forum/bk25786/tz1125710
https://q.yingjiesheng.com/forum/bk25786/tz1125711
https://q.yingjiesheng.com/forum/bk25786/tz1125712
https://q.yingjiesheng.com/forum/bk25786/tz1125713
https://q.yingjiesheng.com/forum/bk25786/tz1125714
https://q.yingjiesheng.com/forum/bk25786/tz1125715
https://q.yingjiesheng.com/forum/bk25786/tz1125716
https://q.yingjiesheng.com/forum/bk25786/tz1125717
https://q.yingjiesheng.com/forum/bk25786/tz1125718
https://q.yingjiesheng.com/forum/bk25786/tz1125719
https://q.yingjiesheng.com/forum/bk25786/tz1125720
https://q.yingjiesheng.com/forum/bk25786/tz1125721
https://q.yingjiesheng.com/forum/bk25786/tz1125722
https://q.yingjiesheng.com/forum/bk25786/tz1125723
https://q.yingjiesheng.com/forum/bk25786/tz1125724
https://q.yingjiesheng.com/forum/bk25786/tz1125725
https://q.yingjiesheng.com/forum/bk25786/tz1125726
https://q.yingjiesheng.com/forum/bk25786/tz1125727
https://q.yingjiesheng.com/forum/bk25786/tz1125728
https://q.yingjiesheng.com/forum/bk25786/tz1125729
https://q.yingjiesheng.com/forum/bk25786/tz1125730
https://q.yingjiesheng.com/forum/bk25786/tz1125731
https://q.yingjiesheng.com/forum/bk25786/tz1125732
https://q.yingjiesheng.com/forum/bk25786/tz1125733
https://q.yingjiesheng.com/forum/bk25786/tz1125734
https://q.yingjiesheng.com/forum/bk25786/tz1125735
https://q.yingjiesheng.com/forum/bk25786/tz1125736
https://q.yingjiesheng.com/forum/bk25786/tz1125737
https://q.yingjiesheng.com/forum/bk25786/tz1125738
https://q.yingjiesheng.com/forum/bk25786/tz1125739
https://q.yingjiesheng.com/forum/bk25786/tz1125740
https://q.yingjiesheng.com/forum/bk25786/tz1125741
https://q.yingjiesheng.com/forum/bk25786/tz1125742
https://q.yingjiesheng.com/forum/bk25786/tz1125743
https://q.yingjiesheng.com/forum/bk25786/tz1125744
https://q.yingjiesheng.com/forum/bk25786/tz1125745
https://q.yingjiesheng.com/forum/bk25786/tz1125746
https://q.yingjiesheng.com/forum/bk25786/tz1125747
https://q.yingjiesheng.com/forum/bk25786/tz1125748
https://q.yingjiesheng.com/forum/bk25786/tz1125749
https://q.yingjiesheng.com/forum/bk25786/tz1125750
https://q.yingjiesheng.com/forum/bk25786/tz1125751
https://q.yingjiesheng.com/forum/bk25786/tz1125752
https://q.yingjiesheng.com/forum/bk25786/tz1125753
https://q.yingjiesheng.com/forum/bk25786/tz1125754
https://q.yingjiesheng.com/forum/bk25786/tz1125755
https://q.yingjiesheng.com/forum/bk25786/tz1125756
https://q.yingjiesheng.com/forum/bk25786/tz1125757
https://q.yingjiesheng.com/forum/bk25786/tz1125758
https://q.yingjiesheng.com/forum/bk25786/tz1125759
https://q.yingjiesheng.com/forum/bk25786/tz1125760
https://q.yingjiesheng.com/forum/bk25786/tz1125761
https://q.yingjiesheng.com/forum/bk25786/tz1125762
https://q.yingjiesheng.com/forum/bk25786/tz1125763
https://q.yingjiesheng.com/forum/bk25786/tz1125764
https://q.yingjiesheng.com/forum/bk25786/tz1125767
https://q.yingjiesheng.com/forum/bk25786/tz1125768
https://q.yingjiesheng.com/forum/bk25786/tz1125769
https://q.yingjiesheng.com/forum/bk25786/tz1125770
https://q.yingjiesheng.com/forum/bk25786/tz1125771
https://q.yingjiesheng.com/forum/bk25786/tz1125772
https://q.yingjiesheng.com/forum/bk25786/tz1125773
https://q.yingjiesheng.com/forum/bk25786/tz1125774
https://q.yingjiesheng.com/forum/bk25786/tz1125775
https://q.yingjiesheng.com/forum/bk25786/tz1125776
https://q.yingjiesheng.com/forum/bk25786/tz1125777
https://q.yingjiesheng.com/forum/bk25786/tz1125778
https://q.yingjiesheng.com/forum/bk25786/tz1125779
https://q.yingjiesheng.com/forum/bk25786/tz1125780
https://q.yingjiesheng.com/forum/bk25786/tz1125781
https://q.yingjiesheng.com/forum/bk25786/tz1125782
https://q.yingjiesheng.com/forum/bk25786/tz1125783
https://q.yingjiesheng.com/forum/bk25786/tz1125784
https://q.yingjiesheng.com/forum/bk25786/tz1125785
https://q.yingjiesheng.com/forum/bk25786/tz1125786
https://q.yingjiesheng.com/forum/bk25786/tz1125787
https://q.yingjiesheng.com/forum/bk25786/tz1125788
https://q.yingjiesheng.com/forum/bk25786/tz1125789
https://q.yingjiesheng.com/forum/bk25786/tz1125790
https://q.yingjiesheng.com/forum/bk25786/tz1125791
https://q.yingjiesheng.com/forum/bk25786/tz1125792
https://q.yingjiesheng.com/forum/bk25786/tz1125793
https://q.yingjiesheng.com/forum/bk25786/tz1125794
https://q.yingjiesheng.com/forum/bk25786/tz1125795
https://q.yingjiesheng.com/forum/bk25786/tz1125796
https://q.yingjiesheng.com/forum/bk25786/tz1125797
https://q.yingjiesheng.com/forum/bk25786/tz1125798
https://q.yingjiesheng.com/forum/bk25786/tz1125799
https://q.yingjiesheng.com/forum/bk25786/tz1125800
https://q.yingjiesheng.com/forum/bk25786/tz1125801
https://q.yingjiesheng.com/forum/bk25786/tz1125802
https://q.yingjiesheng.com/forum/bk25786/tz1125803
https://q.yingjiesheng.com/forum/bk25786/tz1125805
https://q.yingjiesheng.com/forum/bk25786/tz1125806
https://q.yingjiesheng.com/forum/bk25786/tz1125807
https://q.yingjiesheng.com/forum/bk25786/tz1125808
https://q.yingjiesheng.com/forum/bk25786/tz1125809
https://q.yingjiesheng.com/forum/bk25786/tz1125810
https://q.yingjiesheng.com/forum/bk25786/tz1125811
https://q.yingjiesheng.com/forum/bk25786/tz1125812
https://q.yingjiesheng.com/forum/bk25786/tz1125813
https://q.yingjiesheng.com/forum/bk25786/tz1125814
https://q.yingjiesheng.com/forum/bk25786/tz1125815
https://q.yingjiesheng.com/forum/bk25786/tz1125816
https://q.yingjiesheng.com/forum/bk25786/tz1125817
https://q.yingjiesheng.com/forum/bk25786/tz1125818
https://q.yingjiesheng.com/forum/bk25786/tz1125819
https://q.yingjiesheng.com/forum/bk25786/tz1125820
https://q.yingjiesheng.com/forum/bk25786/tz1125821
https://q.yingjiesheng.com/forum/bk25786/tz1125822
https://q.yingjiesheng.com/forum/bk25786/tz1125823
https://q.yingjiesheng.com/forum/bk25786/tz1125824
https://q.yingjiesheng.com/forum/bk25786/tz1125825
https://q.yingjiesheng.com/forum/bk25786/tz1125826
https://q.yingjiesheng.com/forum/bk25786/tz1125827
https://q.yingjiesheng.com/forum/bk25786/tz1125828
https://q.yingjiesheng.com/forum/bk25786/tz1125829
https://q.yingjiesheng.com/forum/bk25786/tz1125830
https://q.yingjiesheng.com/forum/bk25786/tz1125831
https://q.yingjiesheng.com/forum/bk25786/tz1125832
https://q.yingjiesheng.com/forum/bk25786/tz1125833
https://q.yingjiesheng.com/forum/bk25786/tz1125834
https://q.yingjiesheng.com/forum/bk25786/tz1125835
https://q.yingjiesheng.com/forum/bk25786/tz1125836
https://q.yingjiesheng.com/forum/bk25786/tz1125837
https://q.yingjiesheng.com/forum/bk25786/tz1125838
https://q.yingjiesheng.com/forum/bk25786/tz1125839
https://q.yingjiesheng.com/forum/bk25786/tz1125840
https://q.yingjiesheng.com/forum/bk25786/tz1125841
https://q.yingjiesheng.com/forum/bk25786/tz1125842
https://q.yingjiesheng.com/forum/bk25786/tz1125843
https://q.yingjiesheng.com/forum/bk25786/tz1125844
https://q.yingjiesheng.com/forum/bk25786/tz1125845
https://q.yingjiesheng.com/forum/bk25786/tz1125846
https://q.yingjiesheng.com/forum/bk25786/tz1125847
https://q.yingjiesheng.com/forum/bk25786/tz1125848
https://q.yingjiesheng.com/forum/bk25786/tz1125849
https://q.yingjiesheng.com/forum/bk25786/tz1125850
https://q.yingjiesheng.com/forum/bk25786/tz1125851
https://q.yingjiesheng.com/forum/bk25786/tz1125852
https://q.yingjiesheng.com/forum/bk25786/tz1125853
https://q.yingjiesheng.com/forum/bk25786/tz1125854
https://q.yingjiesheng.com/forum/bk25786/tz1125855
https://q.yingjiesheng.com/forum/bk25786/tz1125856
https://q.yingjiesheng.com/forum/bk25786/tz1125857
https://q.yingjiesheng.com/forum/bk25786/tz1125858
https://q.yingjiesheng.com/forum/bk25786/tz1125859
https://q.yingjiesheng.com/forum/bk25786/tz1125860
https://q.yingjiesheng.com/forum/bk25786/tz1125861
https://q.yingjiesheng.com/forum/bk25786/tz1125862
https://q.yingjiesheng.com/forum/bk25786/tz1125863
https://q.yingjiesheng.com/forum/bk25786/tz1125864
https://q.yingjiesheng.com/forum/bk25786/tz1125865
https://q.yingjiesheng.com/forum/bk25786/tz1125866
https://q.yingjiesheng.com/forum/bk25786/tz1125868
https://q.yingjiesheng.com/forum/bk25786/tz1125869
https://q.yingjiesheng.com/forum/bk25786/tz1125871
https://q.yingjiesheng.com/forum/bk25786/tz1125872
https://q.yingjiesheng.com/forum/bk25786/tz1125873
https://q.yingjiesheng.com/forum/bk25786/tz1125874

继续阅读 »

要判断当前行是否保存了代码,可从以下几个维度进行分析,具体方法取决于你所处的场景(如文本编辑器、代码编辑器、文档等),以下是通用判断思路:
一、从内容特征判断
语法结构识别
代码通常包含特定编程语言的语法元素,例如:
编程语言关键词(如 Python 的def、for、if;Java 的public、class、static)。
符号与格式:括号()、花括号{}、方括号[]、分号;、冒号:、运算符+、=、==等。
函数 / 方法调用(如print()、list.append())、变量定义(如int x = 5;)、代码块缩进。
示例:
python
运行
def calculate_sum(a, b):
return a + b

明显包含 Python 函数定义的语法特征,属于代码。
注释与代码标识
代码中常出现注释符号(如//、#、/ /),或被特定标记包裹(如 Markdown 中的代码块符号 ```)。
示例:

这是一行Python注释

// Java代码注释
二、从上下文场景判断
所在平台或工具
若在代码编辑器(如 VS Code、PyCharm)、IDE 或编程相关文档中,当前行更可能是代码。
若在普通文本编辑器、Word 文档或市场分析报告中(如前序对话中的大蒜价格数据),则更可能是纯文本。
前后文关联
查看当前行的上下文:
若前后文有代码块、编程术语(如 “函数”“变量”“循环”),则当前行可能是代码的一部分。
若前后文为自然语言描述(如市场行情、操作步骤),则更可能是普通文本。
三、特殊场景的判断技巧
Markdown 或文档中的代码块
若当前行被 ``或 包裹(如代码块标记),则属于代码。
示例:
java
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World");
}
}

纯文本中的代码片段
即使没有标记,若内容符合编程语言语法(如一行 SQL 语句、HTML 标签),也属于代码。
示例:
SELECT * FROM users WHERE age > 18;(SQL 代码)
<div class="container">内容</div>(HTML 代码)
四、总结:判断流程
看内容:是否包含编程语言关键词、符号、语法结构。
看标记:是否被代码块符号包裹,或有注释符号。
看场景:是否在编程相关工具或上下文中。
若满足以上任意一点,当前行更可能是代码;若内容为自然语言、数据列表或非结构化文本,则不是代码。

https://q.yingjiesheng.com/forum/bk25786/tz1125678
https://q.yingjiesheng.com/forum/bk25786/tz1125679
https://q.yingjiesheng.com/forum/bk25786/tz1125680
https://q.yingjiesheng.com/forum/bk25786/tz1125681
https://q.yingjiesheng.com/forum/bk25786/tz1125682
https://q.yingjiesheng.com/forum/bk25786/tz1125683
https://q.yingjiesheng.com/forum/bk25786/tz1125684
https://q.yingjiesheng.com/forum/bk25786/tz1125685
https://q.yingjiesheng.com/forum/bk25786/tz1125686
https://q.yingjiesheng.com/forum/bk25786/tz1125688
https://q.yingjiesheng.com/forum/bk25786/tz1125690
https://q.yingjiesheng.com/forum/bk25786/tz1125691
https://q.yingjiesheng.com/forum/bk25786/tz1125692
https://q.yingjiesheng.com/forum/bk25786/tz1125693
https://q.yingjiesheng.com/forum/bk25786/tz1125694
https://q.yingjiesheng.com/forum/bk25786/tz1125695
https://q.yingjiesheng.com/forum/bk25786/tz1125696
https://q.yingjiesheng.com/forum/bk25786/tz1125697
https://q.yingjiesheng.com/forum/bk25786/tz1125698
https://q.yingjiesheng.com/forum/bk25786/tz1125699
https://q.yingjiesheng.com/forum/bk25786/tz1125700
https://q.yingjiesheng.com/forum/bk25786/tz1125701
https://q.yingjiesheng.com/forum/bk25786/tz1125702
https://q.yingjiesheng.com/forum/bk25786/tz1125703
https://q.yingjiesheng.com/forum/bk25786/tz1125704
https://q.yingjiesheng.com/forum/bk25786/tz1125705
https://q.yingjiesheng.com/forum/bk25786/tz1125706
https://q.yingjiesheng.com/forum/bk25786/tz1125707
https://q.yingjiesheng.com/forum/bk25786/tz1125708
https://q.yingjiesheng.com/forum/bk25786/tz1125709
https://q.yingjiesheng.com/forum/bk25786/tz1125710
https://q.yingjiesheng.com/forum/bk25786/tz1125711
https://q.yingjiesheng.com/forum/bk25786/tz1125712
https://q.yingjiesheng.com/forum/bk25786/tz1125713
https://q.yingjiesheng.com/forum/bk25786/tz1125714
https://q.yingjiesheng.com/forum/bk25786/tz1125715
https://q.yingjiesheng.com/forum/bk25786/tz1125716
https://q.yingjiesheng.com/forum/bk25786/tz1125717
https://q.yingjiesheng.com/forum/bk25786/tz1125718
https://q.yingjiesheng.com/forum/bk25786/tz1125719
https://q.yingjiesheng.com/forum/bk25786/tz1125720
https://q.yingjiesheng.com/forum/bk25786/tz1125721
https://q.yingjiesheng.com/forum/bk25786/tz1125722
https://q.yingjiesheng.com/forum/bk25786/tz1125723
https://q.yingjiesheng.com/forum/bk25786/tz1125724
https://q.yingjiesheng.com/forum/bk25786/tz1125725
https://q.yingjiesheng.com/forum/bk25786/tz1125726
https://q.yingjiesheng.com/forum/bk25786/tz1125727
https://q.yingjiesheng.com/forum/bk25786/tz1125728
https://q.yingjiesheng.com/forum/bk25786/tz1125729
https://q.yingjiesheng.com/forum/bk25786/tz1125730
https://q.yingjiesheng.com/forum/bk25786/tz1125731
https://q.yingjiesheng.com/forum/bk25786/tz1125732
https://q.yingjiesheng.com/forum/bk25786/tz1125733
https://q.yingjiesheng.com/forum/bk25786/tz1125734
https://q.yingjiesheng.com/forum/bk25786/tz1125735
https://q.yingjiesheng.com/forum/bk25786/tz1125736
https://q.yingjiesheng.com/forum/bk25786/tz1125737
https://q.yingjiesheng.com/forum/bk25786/tz1125738
https://q.yingjiesheng.com/forum/bk25786/tz1125739
https://q.yingjiesheng.com/forum/bk25786/tz1125740
https://q.yingjiesheng.com/forum/bk25786/tz1125741
https://q.yingjiesheng.com/forum/bk25786/tz1125742
https://q.yingjiesheng.com/forum/bk25786/tz1125743
https://q.yingjiesheng.com/forum/bk25786/tz1125744
https://q.yingjiesheng.com/forum/bk25786/tz1125745
https://q.yingjiesheng.com/forum/bk25786/tz1125746
https://q.yingjiesheng.com/forum/bk25786/tz1125747
https://q.yingjiesheng.com/forum/bk25786/tz1125748
https://q.yingjiesheng.com/forum/bk25786/tz1125749
https://q.yingjiesheng.com/forum/bk25786/tz1125750
https://q.yingjiesheng.com/forum/bk25786/tz1125751
https://q.yingjiesheng.com/forum/bk25786/tz1125752
https://q.yingjiesheng.com/forum/bk25786/tz1125753
https://q.yingjiesheng.com/forum/bk25786/tz1125754
https://q.yingjiesheng.com/forum/bk25786/tz1125755
https://q.yingjiesheng.com/forum/bk25786/tz1125756
https://q.yingjiesheng.com/forum/bk25786/tz1125757
https://q.yingjiesheng.com/forum/bk25786/tz1125758
https://q.yingjiesheng.com/forum/bk25786/tz1125759
https://q.yingjiesheng.com/forum/bk25786/tz1125760
https://q.yingjiesheng.com/forum/bk25786/tz1125761
https://q.yingjiesheng.com/forum/bk25786/tz1125762
https://q.yingjiesheng.com/forum/bk25786/tz1125763
https://q.yingjiesheng.com/forum/bk25786/tz1125764
https://q.yingjiesheng.com/forum/bk25786/tz1125767
https://q.yingjiesheng.com/forum/bk25786/tz1125768
https://q.yingjiesheng.com/forum/bk25786/tz1125769
https://q.yingjiesheng.com/forum/bk25786/tz1125770
https://q.yingjiesheng.com/forum/bk25786/tz1125771
https://q.yingjiesheng.com/forum/bk25786/tz1125772
https://q.yingjiesheng.com/forum/bk25786/tz1125773
https://q.yingjiesheng.com/forum/bk25786/tz1125774
https://q.yingjiesheng.com/forum/bk25786/tz1125775
https://q.yingjiesheng.com/forum/bk25786/tz1125776
https://q.yingjiesheng.com/forum/bk25786/tz1125777
https://q.yingjiesheng.com/forum/bk25786/tz1125778
https://q.yingjiesheng.com/forum/bk25786/tz1125779
https://q.yingjiesheng.com/forum/bk25786/tz1125780
https://q.yingjiesheng.com/forum/bk25786/tz1125781
https://q.yingjiesheng.com/forum/bk25786/tz1125782
https://q.yingjiesheng.com/forum/bk25786/tz1125783
https://q.yingjiesheng.com/forum/bk25786/tz1125784
https://q.yingjiesheng.com/forum/bk25786/tz1125785
https://q.yingjiesheng.com/forum/bk25786/tz1125786
https://q.yingjiesheng.com/forum/bk25786/tz1125787
https://q.yingjiesheng.com/forum/bk25786/tz1125788
https://q.yingjiesheng.com/forum/bk25786/tz1125789
https://q.yingjiesheng.com/forum/bk25786/tz1125790
https://q.yingjiesheng.com/forum/bk25786/tz1125791
https://q.yingjiesheng.com/forum/bk25786/tz1125792
https://q.yingjiesheng.com/forum/bk25786/tz1125793
https://q.yingjiesheng.com/forum/bk25786/tz1125794
https://q.yingjiesheng.com/forum/bk25786/tz1125795
https://q.yingjiesheng.com/forum/bk25786/tz1125796
https://q.yingjiesheng.com/forum/bk25786/tz1125797
https://q.yingjiesheng.com/forum/bk25786/tz1125798
https://q.yingjiesheng.com/forum/bk25786/tz1125799
https://q.yingjiesheng.com/forum/bk25786/tz1125800
https://q.yingjiesheng.com/forum/bk25786/tz1125801
https://q.yingjiesheng.com/forum/bk25786/tz1125802
https://q.yingjiesheng.com/forum/bk25786/tz1125803
https://q.yingjiesheng.com/forum/bk25786/tz1125805
https://q.yingjiesheng.com/forum/bk25786/tz1125806
https://q.yingjiesheng.com/forum/bk25786/tz1125807
https://q.yingjiesheng.com/forum/bk25786/tz1125808
https://q.yingjiesheng.com/forum/bk25786/tz1125809
https://q.yingjiesheng.com/forum/bk25786/tz1125810
https://q.yingjiesheng.com/forum/bk25786/tz1125811
https://q.yingjiesheng.com/forum/bk25786/tz1125812
https://q.yingjiesheng.com/forum/bk25786/tz1125813
https://q.yingjiesheng.com/forum/bk25786/tz1125814
https://q.yingjiesheng.com/forum/bk25786/tz1125815
https://q.yingjiesheng.com/forum/bk25786/tz1125816
https://q.yingjiesheng.com/forum/bk25786/tz1125817
https://q.yingjiesheng.com/forum/bk25786/tz1125818
https://q.yingjiesheng.com/forum/bk25786/tz1125819
https://q.yingjiesheng.com/forum/bk25786/tz1125820
https://q.yingjiesheng.com/forum/bk25786/tz1125821
https://q.yingjiesheng.com/forum/bk25786/tz1125822
https://q.yingjiesheng.com/forum/bk25786/tz1125823
https://q.yingjiesheng.com/forum/bk25786/tz1125824
https://q.yingjiesheng.com/forum/bk25786/tz1125825
https://q.yingjiesheng.com/forum/bk25786/tz1125826
https://q.yingjiesheng.com/forum/bk25786/tz1125827
https://q.yingjiesheng.com/forum/bk25786/tz1125828
https://q.yingjiesheng.com/forum/bk25786/tz1125829
https://q.yingjiesheng.com/forum/bk25786/tz1125830
https://q.yingjiesheng.com/forum/bk25786/tz1125831
https://q.yingjiesheng.com/forum/bk25786/tz1125832
https://q.yingjiesheng.com/forum/bk25786/tz1125833
https://q.yingjiesheng.com/forum/bk25786/tz1125834
https://q.yingjiesheng.com/forum/bk25786/tz1125835
https://q.yingjiesheng.com/forum/bk25786/tz1125836
https://q.yingjiesheng.com/forum/bk25786/tz1125837
https://q.yingjiesheng.com/forum/bk25786/tz1125838
https://q.yingjiesheng.com/forum/bk25786/tz1125839
https://q.yingjiesheng.com/forum/bk25786/tz1125840
https://q.yingjiesheng.com/forum/bk25786/tz1125841
https://q.yingjiesheng.com/forum/bk25786/tz1125842
https://q.yingjiesheng.com/forum/bk25786/tz1125843
https://q.yingjiesheng.com/forum/bk25786/tz1125844
https://q.yingjiesheng.com/forum/bk25786/tz1125845
https://q.yingjiesheng.com/forum/bk25786/tz1125846
https://q.yingjiesheng.com/forum/bk25786/tz1125847
https://q.yingjiesheng.com/forum/bk25786/tz1125848
https://q.yingjiesheng.com/forum/bk25786/tz1125849
https://q.yingjiesheng.com/forum/bk25786/tz1125850
https://q.yingjiesheng.com/forum/bk25786/tz1125851
https://q.yingjiesheng.com/forum/bk25786/tz1125852
https://q.yingjiesheng.com/forum/bk25786/tz1125853
https://q.yingjiesheng.com/forum/bk25786/tz1125854
https://q.yingjiesheng.com/forum/bk25786/tz1125855
https://q.yingjiesheng.com/forum/bk25786/tz1125856
https://q.yingjiesheng.com/forum/bk25786/tz1125857
https://q.yingjiesheng.com/forum/bk25786/tz1125858
https://q.yingjiesheng.com/forum/bk25786/tz1125859
https://q.yingjiesheng.com/forum/bk25786/tz1125860
https://q.yingjiesheng.com/forum/bk25786/tz1125861
https://q.yingjiesheng.com/forum/bk25786/tz1125862
https://q.yingjiesheng.com/forum/bk25786/tz1125863
https://q.yingjiesheng.com/forum/bk25786/tz1125864
https://q.yingjiesheng.com/forum/bk25786/tz1125865
https://q.yingjiesheng.com/forum/bk25786/tz1125866
https://q.yingjiesheng.com/forum/bk25786/tz1125868
https://q.yingjiesheng.com/forum/bk25786/tz1125869
https://q.yingjiesheng.com/forum/bk25786/tz1125871
https://q.yingjiesheng.com/forum/bk25786/tz1125872
https://q.yingjiesheng.com/forum/bk25786/tz1125873
https://q.yingjiesheng.com/forum/bk25786/tz1125874

收起阅读 »

在不同分辨率的屏幕下,编辑器菜单字体显示问题

在最新版的编辑器上;1920屏幕上字体还可以;大于2000就 太小了;严重bug

在最新版的编辑器上;1920屏幕上字体还可以;大于2000就 太小了;严重bug

【公告】腾讯云服务空间套餐升级、能力变更通知

uniCloud

为了给开发者提供更加优质可靠的产品服务,腾讯云计划将于2025年6月30日对服务空间套餐进行升级。

套餐升级后,套餐能力也有相应变更,腾讯云会分多次上线能力变更,具体计划如下:

2025年8月31日(已上线)

能力 个人版(19.9元/月) 入门版(99元/月) 标准版(199元/月) 199元以上套餐
云函数 - 超时时间 3s,不支持修改 3s,不支持修改 最大900s 最大900s
云函数 - 运行内存 256M,不支持修改 256M,不支持修改 支持修改 支持修改
云函数 - 日志保存时长 2小时 2小时 3天 7天
前端网页托管 - 防盗链配置 不支持 不支持 支持 支持
前端网页托管 - IP黑白名单配置 不支持 不支持 不支持 支持
前端网页托管 - IP访问限频配置 不支持 不支持 支持 支持

2025年6月30日(已上线)

能力 个人版(19.9元/月) 入门版(99元/月) 199元及以上套餐
云数据库 - 数据库回档 不支持 不支持 支持
云函数 - 固定出口IP 不支持 不支持 支持
  • 变更时间之后将不再支持以上能力,请及时关注您使用的套餐是否强依赖以上变更能力,如有需求可升级更高套餐版本。
  • 现有套餐如果降配到低版本套餐时,以上能力也将会自动变更,套餐不支持的能力将会失效。

套餐版本变更

已与2025年6月30日生效

配额 个人版(提升) 标准版(新增) 初创版(下线) 团队版(下线) 企业版(新增) 团队高级版(下线) 企业增强版(新增) 单位
QPS 500 500 500 1000 1000 1500 1000 -
调用次数 20 800 1000 5000 5000 20000 20000 万次
容量 2 3 100 100 300 500 1500 2000 GB
云函数资源使用量 10 15 60 45 100 150 1000 1500 万GBs
云函数外网出流量 2 4 20 10 25 50 100 200 GB
CDN流量 5 10 300 200 600 1200 2000 4000 GB
CDN回源流量 5 10 120 100 300 600 1000 2000 GB
价格 39.9 19.9 199 299 999 999 4999 4999 元/月
  • 套餐版本增加标准版企业版企业增强版。原有的初创版团队版团队高级版将下线不再支持新购,已有套餐用户不受影响可继续使用、续费。
  • 新增套餐及现有的个人版套餐资源配额提升,部分配额提升50% ~ 100%,个人版套餐资源配额提升已实时生效
  • 账号注册时间自2023年5月1日起,且未创建过腾讯云空间或第一次创建腾讯云空间在2023年10月9日之后,支持购买新增的三个套餐。
继续阅读 »

为了给开发者提供更加优质可靠的产品服务,腾讯云计划将于2025年6月30日对服务空间套餐进行升级。

套餐升级后,套餐能力也有相应变更,腾讯云会分多次上线能力变更,具体计划如下:

2025年8月31日(已上线)

能力 个人版(19.9元/月) 入门版(99元/月) 标准版(199元/月) 199元以上套餐
云函数 - 超时时间 3s,不支持修改 3s,不支持修改 最大900s 最大900s
云函数 - 运行内存 256M,不支持修改 256M,不支持修改 支持修改 支持修改
云函数 - 日志保存时长 2小时 2小时 3天 7天
前端网页托管 - 防盗链配置 不支持 不支持 支持 支持
前端网页托管 - IP黑白名单配置 不支持 不支持 不支持 支持
前端网页托管 - IP访问限频配置 不支持 不支持 支持 支持

2025年6月30日(已上线)

能力 个人版(19.9元/月) 入门版(99元/月) 199元及以上套餐
云数据库 - 数据库回档 不支持 不支持 支持
云函数 - 固定出口IP 不支持 不支持 支持
  • 变更时间之后将不再支持以上能力,请及时关注您使用的套餐是否强依赖以上变更能力,如有需求可升级更高套餐版本。
  • 现有套餐如果降配到低版本套餐时,以上能力也将会自动变更,套餐不支持的能力将会失效。

套餐版本变更

已与2025年6月30日生效

配额 个人版(提升) 标准版(新增) 初创版(下线) 团队版(下线) 企业版(新增) 团队高级版(下线) 企业增强版(新增) 单位
QPS 500 500 500 1000 1000 1500 1000 -
调用次数 20 800 1000 5000 5000 20000 20000 万次
容量 2 3 100 100 300 500 1500 2000 GB
云函数资源使用量 10 15 60 45 100 150 1000 1500 万GBs
云函数外网出流量 2 4 20 10 25 50 100 200 GB
CDN流量 5 10 300 200 600 1200 2000 4000 GB
CDN回源流量 5 10 120 100 300 600 1000 2000 GB
价格 39.9 19.9 199 299 999 999 4999 4999 元/月
  • 套餐版本增加标准版企业版企业增强版。原有的初创版团队版团队高级版将下线不再支持新购,已有套餐用户不受影响可继续使用、续费。
  • 新增套餐及现有的个人版套餐资源配额提升,部分配额提升50% ~ 100%,个人版套餐资源配额提升已实时生效
  • 账号注册时间自2023年5月1日起,且未创建过腾讯云空间或第一次创建腾讯云空间在2023年10月9日之后,支持购买新增的三个套餐。
收起阅读 »

代做.9.png、安卓/uniapp、苹果启动图

启动图片

十年开发、设计经验
1.代做 安卓.9.png 、iOS苹果storyboard 启动图片,不满意免费修改;
2.代上架安卓应用市场/苹果APP Store;
3.解决前/后端问题;
4.定制/二次开发app、小程序、各类网站系统。
5.前端可以做: react、vue、uniapp、Flutter、原生安卓开发、小程序原生开发、安卓原生开发
6.后端可以做:PHP、Java、Python、nodejs
联系方式: wx:lh1845407111 QQ:1845407111
工作室官网:https://www.xiaohongzi.top/h5/#/home 欢迎大家访问
价格便宜,包满意!包满意!包满意!

继续阅读 »

十年开发、设计经验
1.代做 安卓.9.png 、iOS苹果storyboard 启动图片,不满意免费修改;
2.代上架安卓应用市场/苹果APP Store;
3.解决前/后端问题;
4.定制/二次开发app、小程序、各类网站系统。
5.前端可以做: react、vue、uniapp、Flutter、原生安卓开发、小程序原生开发、安卓原生开发
6.后端可以做:PHP、Java、Python、nodejs
联系方式: wx:lh1845407111 QQ:1845407111
工作室官网:https://www.xiaohongzi.top/h5/#/home 欢迎大家访问
价格便宜,包满意!包满意!包满意!

收起阅读 »

nvue页面报错X [ERROR] No matching export in ...... for import "default"

外层 package.json 增加 "pnpm": {"overrides": {"rollup":"4.14.3"}},重新安装,再次打包
记得删除pnpm-lock.yaml 再重新拉 node_modules

继续阅读 »

外层 package.json 增加 "pnpm": {"overrides": {"rollup":"4.14.3"}},重新安装,再次打包
记得删除pnpm-lock.yaml 再重新拉 node_modules

收起阅读 »

关于地图组件拿不到中心点 getCenterLocation 问题,解决方案

uniapp

可以在APP下使用 plus 5+ 方法获取

map html 5+ plus

// #ifdef APP-PLUS  
this.mapContext.$getAppMap().getCurrentCenter((state, point) => {  
    console.log(state, point);  
    if (0 == state) {  
           this.geocodeRegeo(point)  
    } else {  
          console.log("Failed!");  
    }  
    });  
// #endif  
// #ifdef H5  
this.mapContext.getCenterLocation({  
    success: (res) => {  
        this.geocodeRegeo(res)  
    }  
    });  
// #endif               
继续阅读 »

可以在APP下使用 plus 5+ 方法获取

map html 5+ plus

// #ifdef APP-PLUS  
this.mapContext.$getAppMap().getCurrentCenter((state, point) => {  
    console.log(state, point);  
    if (0 == state) {  
           this.geocodeRegeo(point)  
    } else {  
          console.log("Failed!");  
    }  
    });  
// #endif  
// #ifdef H5  
this.mapContext.getCenterLocation({  
    success: (res) => {  
        this.geocodeRegeo(res)  
    }  
    });  
// #endif               
收起阅读 »

创业公司招聘公告

招聘

创业公司团队组建,招聘职位如下,有换工作的小伙伴滴滴。正式面试的时候会打电话通知。只接受上海。

创业公司团队组建,招聘职位如下,有换工作的小伙伴滴滴。正式面试的时候会打电话通知。只接受上海。

最近hbuilderx 怎么停更了,好久没更新了

HBuilderX

最近hbuilderx 怎么停更了,好久没更新了

最近hbuilderx 怎么停更了,好久没更新了

uni-app 能否搞一套声明式UI呢,声明式UI是趋势呢,能极大的提高开发效率呢

鸿蒙的开发思路就是: 声明式UI + TS 这种模式用着很舒服呢

鸿蒙的开发思路就是: 声明式UI + TS 这种模式用着很舒服呢

flutter3.32调用deepseek客户端ai流式模板

flutter

flutter3-win-deepseek:最新研发 flutter3.32+dio+deepseek-v3+window_manager 接入 deepseek-v3 大模型。支持侧边栏收缩、本地会话存储、代码块高亮、代码块横向滚动、表格边框线、图片100%宽度渲染、图片预览、链接跳转

技术栈

  • 开发工具:VScode
  • 技术框架:flutter3.32.0+dart3.8.0
  • 对话大模型:deepseek-v3
  • 流请求:dio^5.8.0+1
  • 窗口管理:window_manager^0.5.0
  • 托盘管理:system_tray^2.0.3
  • 路由/状态管理:get^4.7.2
  • 存储服务:get_storage^2.1.1
  • markdown解析:flutter_markdown^0.7.7
  • 高亮组件:flutter_highlight^0.7.0
  • 环境变量配置:flutter_dotenv^5.2.1

项目特性

  1. 支持侧边栏收缩/展开
  2. 支持多轮对话、代码高亮、本地存储会话
  3. 支持代码块横向滚动、复制代码功能
  4. 支持图片100%宽度渲染、在线图片预览
  5. 支持网络链接跳转、表格功能
  6. 自定义无边框窗口、托盘图标

项目框架目录

flutter3-winseek桌面端ai对话系统已经更新到我的原创作品集。
flutter3.32+deepseek+dio客户端ai流式对话Exe

如果想要了解更多的技术实现细节的话,可以去看看下面这篇分享文章。
flutter3-winseek客户端AI实例|Flutter3.32+DeepSeek流式ai对话模板Exe

热文推荐

flutter3-deepseek流式AI模板|Flutter3.27+Dio+DeepSeeek聊天ai助手
uniapp+vue3+deepseek+uv-ui跨端实战仿deepseek/豆包流式ai聊天对话助手
vue3-webseek网页版AI问答|Vite6+DeepSeek+Arco流式ai聊天打字效果
Electron35-DeepSeek桌面端AI系统|vue3.5+electron+arco客户端ai模板
Vue3-DeepSeek-Chat流式AI对话|vite6+vant4+deepseek智能ai聊天助手
flutter3-dymall仿抖音直播商城|Flutter3.27短视频+直播+聊天App实例
Vite5+Electron聊天室|electron31跨平台仿微信EXE客户端|vue3聊天程序
Tauri2.0-Vue3OS桌面端os平台|tauri2+vite6+arco电脑版OS管理系统
uniapp+vue3聊天室|uni-app+vite4+uv-ui跨端仿微信app聊天语音/朋友圈

继续阅读 »

flutter3-win-deepseek:最新研发 flutter3.32+dio+deepseek-v3+window_manager 接入 deepseek-v3 大模型。支持侧边栏收缩、本地会话存储、代码块高亮、代码块横向滚动、表格边框线、图片100%宽度渲染、图片预览、链接跳转

技术栈

  • 开发工具:VScode
  • 技术框架:flutter3.32.0+dart3.8.0
  • 对话大模型:deepseek-v3
  • 流请求:dio^5.8.0+1
  • 窗口管理:window_manager^0.5.0
  • 托盘管理:system_tray^2.0.3
  • 路由/状态管理:get^4.7.2
  • 存储服务:get_storage^2.1.1
  • markdown解析:flutter_markdown^0.7.7
  • 高亮组件:flutter_highlight^0.7.0
  • 环境变量配置:flutter_dotenv^5.2.1

项目特性

  1. 支持侧边栏收缩/展开
  2. 支持多轮对话、代码高亮、本地存储会话
  3. 支持代码块横向滚动、复制代码功能
  4. 支持图片100%宽度渲染、在线图片预览
  5. 支持网络链接跳转、表格功能
  6. 自定义无边框窗口、托盘图标

项目框架目录

flutter3-winseek桌面端ai对话系统已经更新到我的原创作品集。
flutter3.32+deepseek+dio客户端ai流式对话Exe

如果想要了解更多的技术实现细节的话,可以去看看下面这篇分享文章。
flutter3-winseek客户端AI实例|Flutter3.32+DeepSeek流式ai对话模板Exe

热文推荐

flutter3-deepseek流式AI模板|Flutter3.27+Dio+DeepSeeek聊天ai助手
uniapp+vue3+deepseek+uv-ui跨端实战仿deepseek/豆包流式ai聊天对话助手
vue3-webseek网页版AI问答|Vite6+DeepSeek+Arco流式ai聊天打字效果
Electron35-DeepSeek桌面端AI系统|vue3.5+electron+arco客户端ai模板
Vue3-DeepSeek-Chat流式AI对话|vite6+vant4+deepseek智能ai聊天助手
flutter3-dymall仿抖音直播商城|Flutter3.27短视频+直播+聊天App实例
Vite5+Electron聊天室|electron31跨平台仿微信EXE客户端|vue3聊天程序
Tauri2.0-Vue3OS桌面端os平台|tauri2+vite6+arco电脑版OS管理系统
uniapp+vue3聊天室|uni-app+vite4+uv-ui跨端仿微信app聊天语音/朋友圈

收起阅读 »

unipp---HarmonyOS 应用开发实战

鸿蒙next

HarmonyOS 应用开发实战指南

1. 开篇:为什么选择 HarmonyOS?

最近在开发鸿蒙应用时,发现很多开发者都在问:为什么要选择 HarmonyOS?这里分享一下我的看法:

  1. 生态优势

    • 华为手机用户基数大,市场潜力大
    • 开发者支持力度大,文档更新及时
    • 应用场景丰富,从手机到智能家居都有覆盖
  2. 技术优势

    • 分布式架构确实好用,一次开发多端运行
    • 性能表现不错,特别是启动速度
    • 安全机制做得很到位,对开发者友好
  3. 开发体验

    • Vue 3 开发模式,上手快
    • TypeScript 支持,代码质量有保障
    • 原生能力调用方便,API 设计合理

2. 为什么选择 uni-app x 开发鸿蒙应用?

2.1 降低开发门槛

  1. 不用学鸿蒙原生开发

    • 不用学 ArkTS,省时省力
    • 不用研究鸿蒙原生组件,直接用 Vue 组件
    • 不用适应鸿蒙特有的开发模式,保持原有开发习惯
  2. 用熟悉的技术栈

    • Vue 3 语法,写起来顺手
    • TypeScript 类型检查,减少 bug
    • 组件化开发,代码复用方便
  3. 上手快

    • 有 Vue 经验的直接开干
    • 学习成本低,一周就能上手
    • 遇到问题社区都能找到答案

2.2 开发效率提升

  1. 跨平台开发

    • 一套代码,iOS、Android、鸿蒙都能跑
    • 不用为每个平台写一套代码
    • 维护成本大大降低
  2. 组件库丰富

    • 内置组件够用,不用重复造轮子
    • 自定义组件方便,复用性强
    • 社区组件多,能解决大部分需求
  3. 工具链完善

    • HBuilderX 开发体验好
    • 调试方便,问题定位快
    • 插件生态丰富,开发效率高

2.3 实际开发优势

  1. 代码维护

    • 代码风格统一,团队协作方便
    • 目录结构清晰,找文件快
    • 代码复用性强,减少重复工作
  2. 性能表现

    • 性能接近原生,用户体验好
    • 渲染机制优化得不错
    • 内存管理做得好,不容易卡顿
  3. 发布部署

    • 打包流程简单,一键发布
    • 版本管理方便,回滚容易
    • 更新机制完善,用户无感知

2.4 实际案例分享

  1. 开发周期

    • 原生开发:2-3个月
    • uni-app x:1个月搞定
    • 效率提升:50%以上
  2. 团队配置

    • 原生开发:需要专门的鸿蒙工程师
    • uni-app x:前端工程师就能干
    • 人力成本:省了30%以上
  3. 维护成本

    • 原生开发:要维护多套代码
    • uni-app x:一套代码搞定
    • 维护效率:提升40%以上

2.5 踩过的坑

  1. 性能优化

    • 组件不要嵌套太深
    • 注意内存泄漏问题
    • 长列表要用虚拟列表
  2. 兼容性

    • 不同设备表现可能不一样
    • 横竖屏切换要测试
    • 不同系统版本要适配
  3. 原生能力

    • API 可能有兼容性问题
    • 错误处理要做好
    • 权限申请要规范

3. 开发环境准备

3.1 必需工具

  1. DevEco Studio

    • 下载地址:https://developer.harmonyos.com/cn/develop/deveco-studio
    • 建议版本:最新稳定版
  2. HBuilderX

    • 下载地址:https://www.dcloud.io/hbuilderx.html
    • 建议版本:3.8.0 及以上
    • 安装注意:需要安装 uni-app x 插件

3.2 环境配置

# 检查 Node.js 版本  
node -v  # 建议 16.x 以上  

# 检查 npm 版本  
npm -v   # 建议 8.x 以上  

# 安装 uni-app x 命令行工具  
npm install -g @dcloudio/uni-app-x-cli

4. 实战:系统信息展示应用

4.1 项目结构

project/  
├── src/  
│   ├── pages/  
│   │   └── index/  
│   │       ├── index.uvue    # 主页面  
│   │       └── index.uts     # 页面逻辑  
│   │     
│   ├── static/              # 静态资源  
│   └── manifest.json        # 项目配置  
└── package.json

4.2 核心代码实现

4.2.1 页面结构(index.uvue)

<template>  
  <view>  
    <!-- 顶部标题 -->  
    <view class="header">  
      <text class="title">系统信息</text>  
    </view>  

    <!-- 系统信息展示区 -->  
    <scroll-view class="system-info" scroll-y="true">  
      <!-- 应用信息卡片 -->  
      <view class="info-section">  
        <text class="section-title">应用信息</text>  
        <view class="info-item">  
          <text class="label">应用名称:</text>  
          <text class="value">{{systemInfo.appName}}</text>  
        </view>  
        <!-- 其他应用信息... -->  
      </view>  

      <!-- 其他信息卡片... -->  
    </scroll-view>  
  </view>  
</template>

4.2.2 业务逻辑(index.uts)

// 系统信息接口定义  
interface SystemInfo {  
  // 应用信息  
  appId: string;  
  appName: string;  
  appVersion: string;  
  // ... 其他属性  
}  

export default {  
  data() {  
    return {  
      systemInfo: {} as SystemInfo  
    }  
  },  

  onLoad() {  
    // 获取系统信息  
    this.getSystemInfo()  
  },  

  methods: {  
    getSystemInfo() {  
      uni.getSystemInfo({  
        success: (res: SystemInfo) => {  
          this.systemInfo = res  
          console.log('系统信息获取成功:', res)  
        },  
        fail: (err) => {  
          console.error('系统信息获取失败:', err)  
          uni.showToast({  
            title: '获取系统信息失败',  
            icon: 'none'  
          })  
        }  
      })  
    }  
  }  
}

4.3 样式优化

/* 卡片样式 */  
.info-section {  
  margin: 10px;  
  padding: 15px;  
  background-color: #fff;  
  border-radius: 8px;  
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);  
}  

/* 标题样式 */  
.section-title {  
  font-size: 16px;  
  font-weight: bold;  
  color: #333;  
  margin-bottom: 12px;  
  padding-bottom: 8px;  
  border-bottom: 1px solid #eee;  
}  

/* 信息项样式 */  
.info-item {  
  margin: 8px 0;  
  display: flex;  
  align-items: center;  
}  

.label {  
  color: #666;  
  width: 100px;  
  font-size: 14px;  
}  

.value {  
  color: #333;  
  flex: 1;  
  font-size: 14px;  
  word-break: break-all;  
}

5. 开发经验分享

5.1 常见坑点

  1. 系统信息获取

    • 某些设备可能不支持部分属性
    • 需要做好空值处理
    • 建议添加错误处理
  2. 界面适配

    • 不同设备屏幕尺寸差异大
    • 需要适配横竖屏
    • 注意安全区域
  3. 性能优化

    • 避免频繁获取系统信息
    • 合理使用缓存
    • 注意内存管理

5.2 调试技巧

  1. 日志输出

    // 开发环境日志  
    if (process.env.NODE_ENV === 'development') {  
    console.log('调试信息:', data)  
    }
  2. 错误处理

    try {  
    // 可能出错的代码  
    } catch (error) {  
    console.error('错误信息:', error)  
    uni.showToast({  
    title: '操作失败',  
    icon: 'none'  
    })  
    }

5.3 发布注意事项

  1. 版本号管理

    • 遵循语义化版本
    • 记录更新日志
    • 做好版本兼容
  2. 性能测试

    • 多设备测试
    • 压力测试
    • 内存泄漏检测
  3. 安全考虑

    • 敏感信息加密
    • 权限最小化
    • 数据安全存储

6. 进阶开发

6.1 原生能力调用

// 调用相机示例  
uni.chooseImage({  
  count: 1,  
  success: (res) => {  
    console.log('图片选择成功:', res)  
  }  
})  

// 调用传感器示例  
uni.startAccelerometer({  
  interval: 'game',  
  success: () => {  
    console.log('加速度传感器启动成功')  
  }  
})

6.2 性能优化实践

  1. 图片优化

    • 使用适当的图片格式
    • 控制图片大小
    • 实现懒加载
  2. 列表优化

    • 使用虚拟列表
    • 分页加载
    • 数据缓存
  3. 启动优化

    • 减少启动时加载
    • 使用预加载
    • 优化资源加载

7. 实用资源

7.1 开发工具

  • DevEco Studio:https://developer.harmonyos.com
  • HBuilderX:https://www.dcloud.io
  • 调试工具:Chrome DevTools

7.2 学习资源

  • 官方文档:https://developer.harmonyos.com
  • 示例代码:https://github.com/harmonyos
  • 技术社区:https://developer.huawei.com

7.3 开发规范

  • 代码规范:ESLint + Prettier
  • 提交规范:Git Commit Message
  • 文档规范:Markdown

8. 结语

通过这个实战项目,我们学习了:

  1. 如何搭建开发环境
  2. 如何获取系统信息
  3. 如何优化界面展示
  4. 如何处理常见问题

希望这个指南能帮助您更好地开发 HarmonyOS 应用。记住:

  • 保持代码简洁
  • 注重用户体验
  • 重视性能优化
  • 持续学习进步

如果您有任何问题,欢迎在评论区讨论。祝您开发愉快!

继续阅读 »

HarmonyOS 应用开发实战指南

1. 开篇:为什么选择 HarmonyOS?

最近在开发鸿蒙应用时,发现很多开发者都在问:为什么要选择 HarmonyOS?这里分享一下我的看法:

  1. 生态优势

    • 华为手机用户基数大,市场潜力大
    • 开发者支持力度大,文档更新及时
    • 应用场景丰富,从手机到智能家居都有覆盖
  2. 技术优势

    • 分布式架构确实好用,一次开发多端运行
    • 性能表现不错,特别是启动速度
    • 安全机制做得很到位,对开发者友好
  3. 开发体验

    • Vue 3 开发模式,上手快
    • TypeScript 支持,代码质量有保障
    • 原生能力调用方便,API 设计合理

2. 为什么选择 uni-app x 开发鸿蒙应用?

2.1 降低开发门槛

  1. 不用学鸿蒙原生开发

    • 不用学 ArkTS,省时省力
    • 不用研究鸿蒙原生组件,直接用 Vue 组件
    • 不用适应鸿蒙特有的开发模式,保持原有开发习惯
  2. 用熟悉的技术栈

    • Vue 3 语法,写起来顺手
    • TypeScript 类型检查,减少 bug
    • 组件化开发,代码复用方便
  3. 上手快

    • 有 Vue 经验的直接开干
    • 学习成本低,一周就能上手
    • 遇到问题社区都能找到答案

2.2 开发效率提升

  1. 跨平台开发

    • 一套代码,iOS、Android、鸿蒙都能跑
    • 不用为每个平台写一套代码
    • 维护成本大大降低
  2. 组件库丰富

    • 内置组件够用,不用重复造轮子
    • 自定义组件方便,复用性强
    • 社区组件多,能解决大部分需求
  3. 工具链完善

    • HBuilderX 开发体验好
    • 调试方便,问题定位快
    • 插件生态丰富,开发效率高

2.3 实际开发优势

  1. 代码维护

    • 代码风格统一,团队协作方便
    • 目录结构清晰,找文件快
    • 代码复用性强,减少重复工作
  2. 性能表现

    • 性能接近原生,用户体验好
    • 渲染机制优化得不错
    • 内存管理做得好,不容易卡顿
  3. 发布部署

    • 打包流程简单,一键发布
    • 版本管理方便,回滚容易
    • 更新机制完善,用户无感知

2.4 实际案例分享

  1. 开发周期

    • 原生开发:2-3个月
    • uni-app x:1个月搞定
    • 效率提升:50%以上
  2. 团队配置

    • 原生开发:需要专门的鸿蒙工程师
    • uni-app x:前端工程师就能干
    • 人力成本:省了30%以上
  3. 维护成本

    • 原生开发:要维护多套代码
    • uni-app x:一套代码搞定
    • 维护效率:提升40%以上

2.5 踩过的坑

  1. 性能优化

    • 组件不要嵌套太深
    • 注意内存泄漏问题
    • 长列表要用虚拟列表
  2. 兼容性

    • 不同设备表现可能不一样
    • 横竖屏切换要测试
    • 不同系统版本要适配
  3. 原生能力

    • API 可能有兼容性问题
    • 错误处理要做好
    • 权限申请要规范

3. 开发环境准备

3.1 必需工具

  1. DevEco Studio

    • 下载地址:https://developer.harmonyos.com/cn/develop/deveco-studio
    • 建议版本:最新稳定版
  2. HBuilderX

    • 下载地址:https://www.dcloud.io/hbuilderx.html
    • 建议版本:3.8.0 及以上
    • 安装注意:需要安装 uni-app x 插件

3.2 环境配置

# 检查 Node.js 版本  
node -v  # 建议 16.x 以上  

# 检查 npm 版本  
npm -v   # 建议 8.x 以上  

# 安装 uni-app x 命令行工具  
npm install -g @dcloudio/uni-app-x-cli

4. 实战:系统信息展示应用

4.1 项目结构

project/  
├── src/  
│   ├── pages/  
│   │   └── index/  
│   │       ├── index.uvue    # 主页面  
│   │       └── index.uts     # 页面逻辑  
│   │     
│   ├── static/              # 静态资源  
│   └── manifest.json        # 项目配置  
└── package.json

4.2 核心代码实现

4.2.1 页面结构(index.uvue)

<template>  
  <view>  
    <!-- 顶部标题 -->  
    <view class="header">  
      <text class="title">系统信息</text>  
    </view>  

    <!-- 系统信息展示区 -->  
    <scroll-view class="system-info" scroll-y="true">  
      <!-- 应用信息卡片 -->  
      <view class="info-section">  
        <text class="section-title">应用信息</text>  
        <view class="info-item">  
          <text class="label">应用名称:</text>  
          <text class="value">{{systemInfo.appName}}</text>  
        </view>  
        <!-- 其他应用信息... -->  
      </view>  

      <!-- 其他信息卡片... -->  
    </scroll-view>  
  </view>  
</template>

4.2.2 业务逻辑(index.uts)

// 系统信息接口定义  
interface SystemInfo {  
  // 应用信息  
  appId: string;  
  appName: string;  
  appVersion: string;  
  // ... 其他属性  
}  

export default {  
  data() {  
    return {  
      systemInfo: {} as SystemInfo  
    }  
  },  

  onLoad() {  
    // 获取系统信息  
    this.getSystemInfo()  
  },  

  methods: {  
    getSystemInfo() {  
      uni.getSystemInfo({  
        success: (res: SystemInfo) => {  
          this.systemInfo = res  
          console.log('系统信息获取成功:', res)  
        },  
        fail: (err) => {  
          console.error('系统信息获取失败:', err)  
          uni.showToast({  
            title: '获取系统信息失败',  
            icon: 'none'  
          })  
        }  
      })  
    }  
  }  
}

4.3 样式优化

/* 卡片样式 */  
.info-section {  
  margin: 10px;  
  padding: 15px;  
  background-color: #fff;  
  border-radius: 8px;  
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);  
}  

/* 标题样式 */  
.section-title {  
  font-size: 16px;  
  font-weight: bold;  
  color: #333;  
  margin-bottom: 12px;  
  padding-bottom: 8px;  
  border-bottom: 1px solid #eee;  
}  

/* 信息项样式 */  
.info-item {  
  margin: 8px 0;  
  display: flex;  
  align-items: center;  
}  

.label {  
  color: #666;  
  width: 100px;  
  font-size: 14px;  
}  

.value {  
  color: #333;  
  flex: 1;  
  font-size: 14px;  
  word-break: break-all;  
}

5. 开发经验分享

5.1 常见坑点

  1. 系统信息获取

    • 某些设备可能不支持部分属性
    • 需要做好空值处理
    • 建议添加错误处理
  2. 界面适配

    • 不同设备屏幕尺寸差异大
    • 需要适配横竖屏
    • 注意安全区域
  3. 性能优化

    • 避免频繁获取系统信息
    • 合理使用缓存
    • 注意内存管理

5.2 调试技巧

  1. 日志输出

    // 开发环境日志  
    if (process.env.NODE_ENV === 'development') {  
    console.log('调试信息:', data)  
    }
  2. 错误处理

    try {  
    // 可能出错的代码  
    } catch (error) {  
    console.error('错误信息:', error)  
    uni.showToast({  
    title: '操作失败',  
    icon: 'none'  
    })  
    }

5.3 发布注意事项

  1. 版本号管理

    • 遵循语义化版本
    • 记录更新日志
    • 做好版本兼容
  2. 性能测试

    • 多设备测试
    • 压力测试
    • 内存泄漏检测
  3. 安全考虑

    • 敏感信息加密
    • 权限最小化
    • 数据安全存储

6. 进阶开发

6.1 原生能力调用

// 调用相机示例  
uni.chooseImage({  
  count: 1,  
  success: (res) => {  
    console.log('图片选择成功:', res)  
  }  
})  

// 调用传感器示例  
uni.startAccelerometer({  
  interval: 'game',  
  success: () => {  
    console.log('加速度传感器启动成功')  
  }  
})

6.2 性能优化实践

  1. 图片优化

    • 使用适当的图片格式
    • 控制图片大小
    • 实现懒加载
  2. 列表优化

    • 使用虚拟列表
    • 分页加载
    • 数据缓存
  3. 启动优化

    • 减少启动时加载
    • 使用预加载
    • 优化资源加载

7. 实用资源

7.1 开发工具

  • DevEco Studio:https://developer.harmonyos.com
  • HBuilderX:https://www.dcloud.io
  • 调试工具:Chrome DevTools

7.2 学习资源

  • 官方文档:https://developer.harmonyos.com
  • 示例代码:https://github.com/harmonyos
  • 技术社区:https://developer.huawei.com

7.3 开发规范

  • 代码规范:ESLint + Prettier
  • 提交规范:Git Commit Message
  • 文档规范:Markdown

8. 结语

通过这个实战项目,我们学习了:

  1. 如何搭建开发环境
  2. 如何获取系统信息
  3. 如何优化界面展示
  4. 如何处理常见问题

希望这个指南能帮助您更好地开发 HarmonyOS 应用。记住:

  • 保持代码简洁
  • 注重用户体验
  • 重视性能优化
  • 持续学习进步

如果您有任何问题,欢迎在评论区讨论。祝您开发愉快!

收起阅读 »

uni-app/uniappx 中调用鸿蒙原生扫码能力的实践

鸿蒙next

uni-app/uniappx 中调用鸿蒙原生扫码能力的实践

一、背景介绍

最近在开发一个鸿蒙应用时,遇到了扫码功能的需求。之前用过很多扫码方案,但都不太理想。直到发现了 hmos-scan 这个插件,终于解决了我们的痛点。下面分享一下使用心得。

1.1 为什么选择 hmos-scan?

说实话,之前踩过不少坑:

  1. 传统扫码方案太坑了

    • WebView 扫码慢得要死,经常卡住
    • 引入第三方库后,应用体积直接翻倍
    • 不同手机表现不一样,有的能扫,有的扫不了
    • 稍微模糊一点的码就识别不出来,用户体验太差
  2. 原生开发太痛苦

    • 写原生代码太费时间了
    • 每个平台都要写一遍,累死
    • 维护起来特别麻烦
    • 开发周期太长,老板等不及
  3. hmos-scan 真香

    • 用鸿蒙原生能力,扫码贼快
    • 识别率特别高,歪着扫都能识别
    • 几行代码就搞定了,太方便了
    • 性能好,不占内存
    • 还能从相册选图,太贴心了

1.2 实际使用案例

  1. 电商比价

    // 扫商品码比价  
    async function scanProduct() {  
     try {  
       const barcode = await scanapiSync()  
       // 调用比价接口  
       const priceInfo = await comparePrice(barcode)  
       showPriceResult(priceInfo)  
     } catch (error) {  
       showError('扫码失败,重试一下')  
     }  
    }  
  2. 快递扫描

    // 扫快递单号  
    async function scanExpress() {  
     try {  
       const trackingNumber = await scanapiSync()  
       // 查物流信息  
       const expressInfo = await queryExpress(trackingNumber)  
       showExpressInfo(expressInfo)  
     } catch (error) {  
       showError('扫码失败,重试一下')  
     }  
    }  
  3. 会议签到

    // 扫会议码签到  
    async function scanMeeting() {  
     try {  
       const meetingCode = await scanapiSync()  
       // 验证会议码  
       const checkInResult = await verifyMeeting(meetingCode)  
       showCheckInResult(checkInResult)  
     } catch (error) {  
       showError('签到失败,重试一下')  
     }  
    }  

二、环境准备

  1. 开发工具

    • HBuilderX 3.8.0 或以上版本
    • DevEco Studio(鸿蒙开发必备)
  2. 项目要求

    • 用 uni-app x 框架
    • 选 Vue 3 就对了

三、插件使用

1. 插件安装

  1. 去插件市场:hmos-scan 插件
  2. 下载后导入 HBuilderX 就完事了

四、在项目中使用

1. 基础示例

<!-- pages/index/index.uvue -->  
<template>  
  <view class="content">  
    <button @click="startScan">开始扫描</button>  
    <text v-if="scanResult">扫描结果:{{scanResult}}</text>  
  </view>  
</template>  

<script>  
import { scanapiSync } from "@/uni_modules/hmos-scan/utssdk/app-harmony";  

export default {  
  data() {  
    return {  
      scanResult: ''  
    }  
  },  
  methods: {  
    async startScan() {  
      try {  
        const result = await scanapiSync()  
        this.scanResult = result  
        console.log('扫描结果:', result)  
      } catch (error) {  
        console.error('扫描失败:', error)  
        this.scanResult = '扫描失败'  
      }  
    }  
  }  
}  
</script>  

<style>  
.content {  
  padding: 20px;  
}  
button {  
  margin: 20px 0;  
}  
</style>

2. 高级示例(带历史记录)

<!-- pages/advanced/index.uvue -->  
<template>  
  <view class="container">  
    <view class="scan-area">  
      <button @click="startScan" :disabled="isScanning">  
        {{isScanning ? '扫描中...' : '开始扫描'}}  
      </button>  
    </view>  

    <view class="result-area" v-if="scanHistory.length > 0">  
      <text class="title">扫描历史</text>  
      <view v-for="(item, index) in scanHistory" :key="index" class="history-item">  
        <text class="time">{{item.time}}</text>  
        <text class="content">{{item.content}}</text>  
      </view>  
    </view>  
  </view>  
</template>  

<script>  
import { scanapiSync } from "@/uni_modules/hmos-scan/utssdk/app-harmony";  

export default {  
  data() {  
    return {  
      isScanning: false,  
      scanHistory: []  
    }  
  },  
  methods: {  
    async startScan() {  
      if (this.isScanning) return  

      this.isScanning = true  
      try {  
        const result = await scanapiSync()  
        this.scanHistory.unshift({  
          time: new Date().toLocaleTimeString(),  
          content: result  
        })  
      } catch (error) {  
        console.error('扫描失败:', error)  
      } finally {  
        this.isScanning = false  
      }  
    }  
  }  
}  
</script>  

<style>  
.container {  
  padding: 20px;  
}  
.scan-area {  
  margin-bottom: 20px;  
}  
.result-area {  
  border-top: 1px solid #eee;  
  padding-top: 20px;  
}  
.title {  
  font-size: 16px;  
  font-weight: bold;  
  margin-bottom: 10px;  
}  
.history-item {  
  padding: 10px;  
  border-bottom: 1px solid #eee;  
}  
.time {  
  font-size: 12px;  
  color: #999;  
}  
.content {  
  margin-top: 5px;  
}  
</style>

五、功能特点

  1. 多模式支持

    • 二维码、条形码都能扫
    • 相册选图也支持
  2. 错误处理

    • 各种异常都处理好了
    • 提示信息很友好
    • 日志记录很详细
  3. 用户体验

    • 操作简单,一看就会
    • 有状态反馈,不会卡住
    • 异步处理,不阻塞界面

六、注意事项

  1. 兼容性

    • 只支持鸿蒙系统
    • 确保设备有扫码功能
  2. 性能优化

    • 注意内存使用
    • 及时释放资源
    • 别重复扫描

七、常见问题

  1. 扫描失败

    • 看看设备支不支持
    • 查查日志找原因
  2. 结果解析错误

    • 检查结果格式
    • 处理各种返回类型
    • 加好错误处理

八、总结

用了 hmos-scan 插件后,扫码功能开发变得特别简单。原生功能完整保留,开发体验又好,强烈推荐!

九、参考资料

  1. uni-app x 开发文档
  2. 鸿蒙开发文档
  3. UTS 插件开发指南
  4. hmos-scan 插件下载地址
继续阅读 »

uni-app/uniappx 中调用鸿蒙原生扫码能力的实践

一、背景介绍

最近在开发一个鸿蒙应用时,遇到了扫码功能的需求。之前用过很多扫码方案,但都不太理想。直到发现了 hmos-scan 这个插件,终于解决了我们的痛点。下面分享一下使用心得。

1.1 为什么选择 hmos-scan?

说实话,之前踩过不少坑:

  1. 传统扫码方案太坑了

    • WebView 扫码慢得要死,经常卡住
    • 引入第三方库后,应用体积直接翻倍
    • 不同手机表现不一样,有的能扫,有的扫不了
    • 稍微模糊一点的码就识别不出来,用户体验太差
  2. 原生开发太痛苦

    • 写原生代码太费时间了
    • 每个平台都要写一遍,累死
    • 维护起来特别麻烦
    • 开发周期太长,老板等不及
  3. hmos-scan 真香

    • 用鸿蒙原生能力,扫码贼快
    • 识别率特别高,歪着扫都能识别
    • 几行代码就搞定了,太方便了
    • 性能好,不占内存
    • 还能从相册选图,太贴心了

1.2 实际使用案例

  1. 电商比价

    // 扫商品码比价  
    async function scanProduct() {  
     try {  
       const barcode = await scanapiSync()  
       // 调用比价接口  
       const priceInfo = await comparePrice(barcode)  
       showPriceResult(priceInfo)  
     } catch (error) {  
       showError('扫码失败,重试一下')  
     }  
    }  
  2. 快递扫描

    // 扫快递单号  
    async function scanExpress() {  
     try {  
       const trackingNumber = await scanapiSync()  
       // 查物流信息  
       const expressInfo = await queryExpress(trackingNumber)  
       showExpressInfo(expressInfo)  
     } catch (error) {  
       showError('扫码失败,重试一下')  
     }  
    }  
  3. 会议签到

    // 扫会议码签到  
    async function scanMeeting() {  
     try {  
       const meetingCode = await scanapiSync()  
       // 验证会议码  
       const checkInResult = await verifyMeeting(meetingCode)  
       showCheckInResult(checkInResult)  
     } catch (error) {  
       showError('签到失败,重试一下')  
     }  
    }  

二、环境准备

  1. 开发工具

    • HBuilderX 3.8.0 或以上版本
    • DevEco Studio(鸿蒙开发必备)
  2. 项目要求

    • 用 uni-app x 框架
    • 选 Vue 3 就对了

三、插件使用

1. 插件安装

  1. 去插件市场:hmos-scan 插件
  2. 下载后导入 HBuilderX 就完事了

四、在项目中使用

1. 基础示例

<!-- pages/index/index.uvue -->  
<template>  
  <view class="content">  
    <button @click="startScan">开始扫描</button>  
    <text v-if="scanResult">扫描结果:{{scanResult}}</text>  
  </view>  
</template>  

<script>  
import { scanapiSync } from "@/uni_modules/hmos-scan/utssdk/app-harmony";  

export default {  
  data() {  
    return {  
      scanResult: ''  
    }  
  },  
  methods: {  
    async startScan() {  
      try {  
        const result = await scanapiSync()  
        this.scanResult = result  
        console.log('扫描结果:', result)  
      } catch (error) {  
        console.error('扫描失败:', error)  
        this.scanResult = '扫描失败'  
      }  
    }  
  }  
}  
</script>  

<style>  
.content {  
  padding: 20px;  
}  
button {  
  margin: 20px 0;  
}  
</style>

2. 高级示例(带历史记录)

<!-- pages/advanced/index.uvue -->  
<template>  
  <view class="container">  
    <view class="scan-area">  
      <button @click="startScan" :disabled="isScanning">  
        {{isScanning ? '扫描中...' : '开始扫描'}}  
      </button>  
    </view>  

    <view class="result-area" v-if="scanHistory.length > 0">  
      <text class="title">扫描历史</text>  
      <view v-for="(item, index) in scanHistory" :key="index" class="history-item">  
        <text class="time">{{item.time}}</text>  
        <text class="content">{{item.content}}</text>  
      </view>  
    </view>  
  </view>  
</template>  

<script>  
import { scanapiSync } from "@/uni_modules/hmos-scan/utssdk/app-harmony";  

export default {  
  data() {  
    return {  
      isScanning: false,  
      scanHistory: []  
    }  
  },  
  methods: {  
    async startScan() {  
      if (this.isScanning) return  

      this.isScanning = true  
      try {  
        const result = await scanapiSync()  
        this.scanHistory.unshift({  
          time: new Date().toLocaleTimeString(),  
          content: result  
        })  
      } catch (error) {  
        console.error('扫描失败:', error)  
      } finally {  
        this.isScanning = false  
      }  
    }  
  }  
}  
</script>  

<style>  
.container {  
  padding: 20px;  
}  
.scan-area {  
  margin-bottom: 20px;  
}  
.result-area {  
  border-top: 1px solid #eee;  
  padding-top: 20px;  
}  
.title {  
  font-size: 16px;  
  font-weight: bold;  
  margin-bottom: 10px;  
}  
.history-item {  
  padding: 10px;  
  border-bottom: 1px solid #eee;  
}  
.time {  
  font-size: 12px;  
  color: #999;  
}  
.content {  
  margin-top: 5px;  
}  
</style>

五、功能特点

  1. 多模式支持

    • 二维码、条形码都能扫
    • 相册选图也支持
  2. 错误处理

    • 各种异常都处理好了
    • 提示信息很友好
    • 日志记录很详细
  3. 用户体验

    • 操作简单,一看就会
    • 有状态反馈,不会卡住
    • 异步处理,不阻塞界面

六、注意事项

  1. 兼容性

    • 只支持鸿蒙系统
    • 确保设备有扫码功能
  2. 性能优化

    • 注意内存使用
    • 及时释放资源
    • 别重复扫描

七、常见问题

  1. 扫描失败

    • 看看设备支不支持
    • 查查日志找原因
  2. 结果解析错误

    • 检查结果格式
    • 处理各种返回类型
    • 加好错误处理

八、总结

用了 hmos-scan 插件后,扫码功能开发变得特别简单。原生功能完整保留,开发体验又好,强烈推荐!

九、参考资料

  1. uni-app x 开发文档
  2. 鸿蒙开发文档
  3. UTS 插件开发指南
  4. hmos-scan 插件下载地址
收起阅读 »