File tree Expand file tree Collapse file tree 7 files changed +149
-5
lines changed
Expand file tree Collapse file tree 7 files changed +149
-5
lines changed Original file line number Diff line number Diff line change 1+ import { goBackOrGoHome } from 'tdesign-uniapp/common/route' ;
2+
3+ const SHARE_INFO = {
4+ title : 'TDesign UI' ,
5+ } ;
6+
7+
18export default {
9+ onShareAppMessage ( ) {
10+ return SHARE_INFO ;
11+ } ,
12+ onShareTimeline ( ) {
13+ return SHARE_INFO ;
14+ } ,
215 computed : {
316 gCustomNavbarHeight ( ) {
417 let result = 0 ;
@@ -29,4 +42,22 @@ export default {
2942 return result ;
3043 } ,
3144 } ,
45+ mounted ( ) {
46+ // 检查分享功能是否可用
47+ // #ifdef MP-WEIXIN
48+ if ( typeof wx . showShareMenu === 'function' ) {
49+ wx . showShareMenu ( {
50+ success : ( ) => {
51+ } ,
52+ fail : ( ) => {
53+ } ,
54+ } ) ;
55+ }
56+ // #endif
57+ } ,
58+ methods : {
59+ onDemoGoBack ( ) {
60+ goBackOrGoHome ( ) ;
61+ } ,
62+ } ,
3263} ;
Original file line number Diff line number Diff line change @@ -168,7 +168,7 @@ export default uniComponent({
168168<style scoped>
169169@import ' ./chat-list.css' ;
170170
171- /* #ifdef H5 */
171+ /* #ifdef H5 || APP-PLUS */
172172.t-chat-list__content :deep(.uni-scroll-view-content ) {
173173 display : flex ;;
174174 flex-direction : column ;
Original file line number Diff line number Diff line change 222222import chatMarkdownCode from ' ../chat-markdown-code/chat-markdown-code.vue' ;
223223import { prefix } from ' tdesign-uniapp/common/config' ;
224224import { uniComponent } from ' tdesign-uniapp/common/src/index' ;
225- // #ifndef H5
225+ // #ifdef MP
226226import { TChatMarkdownNode } from ' ./chat-markdown-node.vue' ;
227227// #endif
228228
@@ -240,7 +240,7 @@ export default uniComponent({
240240 components: {
241241 // chatMarkdownTable,
242242 chatMarkdownCode,
243- // #ifndef H5
243+ // #ifdef MP
244244 TChatMarkdownNode,
245245 // #endif
246246 },
Original file line number Diff line number Diff line change 77 </view >
88</template >
99<script >
10+ import ' ./polyfill' ;
1011import chatMarkdownNode from ' ../chat-markdown-node/chat-markdown-node.vue' ;
12+ // #ifdef APP-PLUS
13+ import { Lexer as LexerUni } from ' ../npm/marked/uniapp' ;
14+ // #endif
15+
16+ // #ifndef APP-PLUS
1117import { Lexer } from ' ../npm/marked' ;
18+ // #endif
19+
1220import { prefix } from ' tdesign-uniapp/common/config' ;
1321import props from ' ./props' ;
1422import _ from ' tdesign-uniapp/common/utils.wxs' ;
@@ -55,7 +63,14 @@ export default uniComponent({
5563 // 解析markdown文本
5664 parseMarkdown (markdown ) {
5765 try {
58- const lexer = new Lexer (this .options );
66+ let lexer;
67+ // #ifdef APP-PLUS
68+ lexer = new LexerUni (this .options );
69+ // #endif
70+ // #ifndef APP-PLUS
71+ lexer = new Lexer (this .options );
72+ // #endif
73+
5974 const tokens = lexer .lex (markdown);
6075
6176 this .nodes = tokens;
Original file line number Diff line number Diff line change 1+ // 为数组 (Array) 添加 at 方法的 polyfill
2+ if ( ! Array . prototype . at ) {
3+ Array . prototype . at = function ( index ) {
4+ // 将索引转换为数字
5+ index = Math . trunc ( index ) || 0 ;
6+ // 如果索引是负数,则从数组末尾开始计算
7+ if ( index < 0 ) index += this . length ;
8+ // 如果计算后的索引超出范围,则返回 undefined
9+ if ( index < 0 || index >= this . length ) return undefined ;
10+ // 返回指定索引的元素
11+ return this [ index ] ;
12+ } ;
13+ }
14+
15+ // 为字符串 (String) 添加 at 方法的 polyfill
16+ if ( ! String . prototype . at ) {
17+ String . prototype . at = function ( index ) {
18+ // 将索引转换为数字
19+ index = Math . trunc ( index ) || 0 ;
20+ // 如果索引是负数,则从字符串末尾开始计算
21+ if ( index < 0 ) index += this . length ;
22+ // 如果计算后的索引超出范围,则返回空字符串
23+ if ( index < 0 || index >= this . length ) return '' ;
24+ // 返回指定索引的字符
25+ return this [ index ] ;
26+ } ;
27+ }
Original file line number Diff line number Diff line change 7676 :show-menu-by-longpress =" showMenuByLongpress"
7777 :aria-hidden =" ariaHidden || isLoading || isFailed"
7878 :aria-label =" ariaLabel"
79+ @click =" onClick"
7980 @load =" onLoaded"
8081 @error =" onLoadError"
81- @click.stop =" onClick"
8282 />
8383 </view >
8484</template >
You can’t perform that action at this time.
0 commit comments