fix(vant-markdown-loader): 修复 demo 组件和其他组件重名导致的渲染异常 (#8348)

This commit is contained in:
郑昊川
2021-03-15 17:49:35 +08:00
committed by GitHub
parent 919a9976b1
commit b2062d48aa
2 changed files with 3 additions and 3 deletions

View File

@@ -14,7 +14,7 @@ module.exports = function extraDemo(content) {
/<demo-code([\s\S]*?)>([\s\S]*?)<\/demo-code>/g,
function (_, attrs, link) {
link = link.trim(); // 去换行符
const tag = hyphenate(path.basename(link, '.vue'));
const tag = 'demo-code-' + hyphenate(path.basename(link, '.vue'));
const fullLink = path.join(markdownDir, link);
demoLinks.indexOf(fullLink) === -1 && demoLinks.push(fullLink);
const demoContent = fs.readFileSync(fullLink, { encoding: 'utf8' });