Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

html解析错误 #65

Closed
1591582901 opened this issue Mar 15, 2023 · 1 comment
Closed

html解析错误 #65

1591582901 opened this issue Mar 15, 2023 · 1 comment

Comments

@1591582901
Copy link

作者你好,这是我使用html-to-md产生的错误:

代码

let mailContent = this.$refs.mailContent.$el;
let articleContent =
  mailContent.getElementsByClassName("articleContent")[0];
console.log("-----articleContent-----", articleContent);
const html2md = require('html-to-md')
let md = html2md(articleContent, {ignoreTags:[],}, false);

报错

TypeError: t.replace is not a function
    at e.default (index.js?5145:1:1)
    at e.default (index.js?5145:1:1)
    at _callee$ (index.js?!./node_modules/vue-loader/lib/index.js?!./node_modules/string-replace-loader/index.js?!./pages/mailAssistant/index.vue?vue&type=script&lang=js&:127:22)
    at tryCatch (polyfill.min.js:1:93205)
    at Generator.invoke [as _invoke] (polyfill.min.js:1:92979)
    at t.<computed> [as next] (polyfill.min.js:1:93737)
    at asyncGeneratorStep (asyncToGenerator.js?1da1:3:1)
    at _next (asyncToGenerator.js?1da1:25:1)
    at eval (asyncToGenerator.js?1da1:32:1)
    at new Promise (<anonymous>)
@1591582901
Copy link
Author

作者你好,是我自己代码写错了,闹了乌龙了。。。
正确代码应该是:

let mailContent = this.$refs.mailContent.$el;
let articleContent =
  mailContent.getElementsByClassName("articleContent")[0];
console.log("-----articleContent-----", articleContent);
const html2md = require('html-to-md')
let md = html2md(articleContent.innerHTML, {ignoreTags:[],}, false);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant