diff --git a/packages/pro-components/chat/chat-markdown/_example/base/index.js b/packages/pro-components/chat/chat-markdown/_example/base/index.js index e3af7a6a7..dbe810be1 100644 --- a/packages/pro-components/chat/chat-markdown/_example/base/index.js +++ b/packages/pro-components/chat/chat-markdown/_example/base/index.js @@ -5,7 +5,15 @@ Page({ markdownContent: markdownData, }, handleNodeTap(e) { + const { node } = e.detail; // 打印节点信息 - console.log('点击节点', e.detail.node); + console.log('点击节点', node); + // 图片节点预览 + if (node && node.type === 'image') { + wx.previewImage({ + urls: [node.href], + current: node.href, + }); + } }, }); diff --git a/packages/pro-components/chat/chat-markdown/_example/code/index.js b/packages/pro-components/chat/chat-markdown/_example/code/index.js index e3af7a6a7..dbe810be1 100644 --- a/packages/pro-components/chat/chat-markdown/_example/code/index.js +++ b/packages/pro-components/chat/chat-markdown/_example/code/index.js @@ -5,7 +5,15 @@ Page({ markdownContent: markdownData, }, handleNodeTap(e) { + const { node } = e.detail; // 打印节点信息 - console.log('点击节点', e.detail.node); + console.log('点击节点', node); + // 图片节点预览 + if (node && node.type === 'image') { + wx.previewImage({ + urls: [node.href], + current: node.href, + }); + } }, }); diff --git a/packages/pro-components/chat/chat-markdown/_example/list/index.js b/packages/pro-components/chat/chat-markdown/_example/list/index.js index e3af7a6a7..dbe810be1 100644 --- a/packages/pro-components/chat/chat-markdown/_example/list/index.js +++ b/packages/pro-components/chat/chat-markdown/_example/list/index.js @@ -5,7 +5,15 @@ Page({ markdownContent: markdownData, }, handleNodeTap(e) { + const { node } = e.detail; // 打印节点信息 - console.log('点击节点', e.detail.node); + console.log('点击节点', node); + // 图片节点预览 + if (node && node.type === 'image') { + wx.previewImage({ + urls: [node.href], + current: node.href, + }); + } }, }); diff --git a/packages/pro-components/chat/chat-markdown/_example/refer/index.js b/packages/pro-components/chat/chat-markdown/_example/refer/index.js index e3af7a6a7..dbe810be1 100644 --- a/packages/pro-components/chat/chat-markdown/_example/refer/index.js +++ b/packages/pro-components/chat/chat-markdown/_example/refer/index.js @@ -5,7 +5,15 @@ Page({ markdownContent: markdownData, }, handleNodeTap(e) { + const { node } = e.detail; // 打印节点信息 - console.log('点击节点', e.detail.node); + console.log('点击节点', node); + // 图片节点预览 + if (node && node.type === 'image') { + wx.previewImage({ + urls: [node.href], + current: node.href, + }); + } }, }); diff --git a/packages/pro-components/chat/chat-markdown/_example/sheet/index.js b/packages/pro-components/chat/chat-markdown/_example/sheet/index.js index e3af7a6a7..dbe810be1 100644 --- a/packages/pro-components/chat/chat-markdown/_example/sheet/index.js +++ b/packages/pro-components/chat/chat-markdown/_example/sheet/index.js @@ -5,7 +5,15 @@ Page({ markdownContent: markdownData, }, handleNodeTap(e) { + const { node } = e.detail; // 打印节点信息 - console.log('点击节点', e.detail.node); + console.log('点击节点', node); + // 图片节点预览 + if (node && node.type === 'image') { + wx.previewImage({ + urls: [node.href], + current: node.href, + }); + } }, }); diff --git a/packages/pro-components/chat/chat-markdown/_example/url/index.js b/packages/pro-components/chat/chat-markdown/_example/url/index.js index e3af7a6a7..dbe810be1 100644 --- a/packages/pro-components/chat/chat-markdown/_example/url/index.js +++ b/packages/pro-components/chat/chat-markdown/_example/url/index.js @@ -5,7 +5,15 @@ Page({ markdownContent: markdownData, }, handleNodeTap(e) { + const { node } = e.detail; // 打印节点信息 - console.log('点击节点', e.detail.node); + console.log('点击节点', node); + // 图片节点预览 + if (node && node.type === 'image') { + wx.previewImage({ + urls: [node.href], + current: node.href, + }); + } }, }); diff --git a/packages/uniapp-pro-components/chat/chat-markdown/_example/base/index.vue b/packages/uniapp-pro-components/chat/chat-markdown/_example/base/index.vue index 21ece3417..3a2d668e5 100644 --- a/packages/uniapp-pro-components/chat/chat-markdown/_example/base/index.vue +++ b/packages/uniapp-pro-components/chat/chat-markdown/_example/base/index.vue @@ -43,7 +43,16 @@ export default { }, methods: { handleNodeTap(e) { - console.log('节点信息', e.node); + const { node } = e; + // 打印节点信息 + console.log('节点信息', node); + // 图片节点预览 + if (node && node.type === 'image') { + uni.previewImage({ + urls: [node.href], + current: node.href, + }); + } }, }, }; diff --git a/packages/uniapp-pro-components/chat/chat-markdown/_example/code/index.vue b/packages/uniapp-pro-components/chat/chat-markdown/_example/code/index.vue index 5500456da..eaf90802e 100644 --- a/packages/uniapp-pro-components/chat/chat-markdown/_example/code/index.vue +++ b/packages/uniapp-pro-components/chat/chat-markdown/_example/code/index.vue @@ -29,7 +29,16 @@ export default { }, methods: { handleNodeTap(e) { - console.log('节点信息', e.node); + const { node } = e; + // 打印节点信息 + console.log('节点信息', node); + // 图片节点预览 + if (node && node.type === 'image') { + uni.previewImage({ + urls: [node.href], + current: node.href, + }); + } }, }, }; diff --git a/packages/uniapp-pro-components/chat/chat-markdown/_example/list/index.vue b/packages/uniapp-pro-components/chat/chat-markdown/_example/list/index.vue index a0e91753d..906ef5e87 100644 --- a/packages/uniapp-pro-components/chat/chat-markdown/_example/list/index.vue +++ b/packages/uniapp-pro-components/chat/chat-markdown/_example/list/index.vue @@ -32,7 +32,16 @@ export default { }, methods: { handleNodeTap(e) { - console.log('节点信息', e.node); + const { node } = e; + // 打印节点信息 + console.log('节点信息', node); + // 图片节点预览 + if (node && node.type === 'image') { + uni.previewImage({ + urls: [node.href], + current: node.href, + }); + } }, }, }; diff --git a/packages/uniapp-pro-components/chat/chat-markdown/_example/refer/index.vue b/packages/uniapp-pro-components/chat/chat-markdown/_example/refer/index.vue index 138b3dfd4..a02397ad7 100644 --- a/packages/uniapp-pro-components/chat/chat-markdown/_example/refer/index.vue +++ b/packages/uniapp-pro-components/chat/chat-markdown/_example/refer/index.vue @@ -28,7 +28,16 @@ export default { }, methods: { handleNodeTap(e) { - console.log('节点信息', e.node); + const { node } = e; + // 打印节点信息 + console.log('节点信息', node); + // 图片节点预览 + if (node && node.type === 'image') { + uni.previewImage({ + urls: [node.href], + current: node.href, + }); + } }, }, }; diff --git a/packages/uniapp-pro-components/chat/chat-markdown/_example/sheet/index.vue b/packages/uniapp-pro-components/chat/chat-markdown/_example/sheet/index.vue index 449c2949b..ce3f7f63e 100644 --- a/packages/uniapp-pro-components/chat/chat-markdown/_example/sheet/index.vue +++ b/packages/uniapp-pro-components/chat/chat-markdown/_example/sheet/index.vue @@ -28,7 +28,16 @@ export default { }, methods: { handleNodeTap(e) { - console.log('节点信息', e.node); + const { node } = e; + // 打印节点信息 + console.log('节点信息', node); + // 图片节点预览 + if (node && node.type === 'image') { + uni.previewImage({ + urls: [node.href], + current: node.href, + }); + } }, }, }; diff --git a/packages/uniapp-pro-components/chat/chat-markdown/_example/url/index.vue b/packages/uniapp-pro-components/chat/chat-markdown/_example/url/index.vue index e7d30f4fc..3a5ba0fe3 100644 --- a/packages/uniapp-pro-components/chat/chat-markdown/_example/url/index.vue +++ b/packages/uniapp-pro-components/chat/chat-markdown/_example/url/index.vue @@ -26,7 +26,16 @@ export default { }, methods: { handleNodeTap(e) { - console.log('节点信息', e.node); + const { node } = e; + // 打印节点信息 + console.log('节点信息', node); + // 图片节点预览 + if (node && node.type === 'image') { + uni.previewImage({ + urls: [node.href], + current: node.href, + }); + } }, }, };