1***@qq.com
1***@qq.com
  • 发布:2024-08-22 11:06
  • 更新:2024-08-22 11:54
  • 阅读:57

#插件讨论# 【 markdown-render - 味蕾 】 内容文字实时转语音

分类:uni-app
关联插件: markdown-render

这个markdown渲染出来之后我还想调用百度的文字转语音进行播放,请问我如何获取渲染出来的那个文字呢

2024-08-22 11:06 负责人:无 分享
已邀请:
味蕾

味蕾

可以通过ref获取markdown-render组件内部的nodes,nodes的值是带html标签的字符串,用正则匹配一下你要语音播放的文字在哪个标签里面

        const nodeText = this.$refs.md.nodes;  
        const pText = nodesss.matchAll(/<p[^>]*>([^<]+)<\/p>/g);  
        const pText = Array.from(h1Matches, (match) => match[1]);  
               console.log(pText);

试下是否满足你的需求

要回复问题请先登录注册