Skip to content

Commit

Permalink
[新增] 子表 支持自定义展开内容
Browse files Browse the repository at this point in the history
  • Loading branch information
yelog committed Jul 19, 2020
1 parent 277186b commit 6cf4a42
Show file tree
Hide file tree
Showing 59 changed files with 295 additions and 120 deletions.
7 changes: 6 additions & 1 deletion build/md-loader/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const {
stripScript,
stripTemplate,
stripTpl,
stripStyle,
genInlineComponentText
} = require('./util')
const md = require('./config')
Expand All @@ -15,6 +16,7 @@ module.exports = function(source) {
const endTagLen = endTag.length

let componenetsString = ''
let style = ''
let id = 0 // demo 的 id
const output = [] // 输出的内容
let start = 0 // 字符串开始位置
Expand All @@ -27,6 +29,7 @@ module.exports = function(source) {
const commentContent = content.slice(commentStart + startTagLen, commentEnd)
const html = stripTemplate(commentContent)
const script = stripScript(commentContent)
style += stripStyle(commentContent)
const tpl = stripTpl(commentContent)
const demoComponentContent = genInlineComponentText(html, script, tpl)
const demoComponentName = `element-demo${id}`
Expand Down Expand Up @@ -64,7 +67,6 @@ module.exports = function(source) {
start = content.indexOf('</script>') + '</script>'.length
pageScript = content.slice(0, start)
}

output.push(content.slice(start))
return `
<template>
Expand All @@ -73,5 +75,8 @@ module.exports = function(source) {
</section>
</template>
${pageScript}
<style lang="scss">
${style}
</style>
`
}
1 change: 1 addition & 0 deletions build/webpack.docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ const webpackConfig = {
from: 'codemirror',
to: 'codemirror'
},
{from: 'images', to: 'images'},
{
from: 'layui',
to: 'layui'
Expand Down
14 changes: 7 additions & 7 deletions data-1.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"title": "如梦令·黄叶青苔归路",
"dynasty": "清代",
"author": "纳兰性德",
"content": "黄叶青苔归路,屧粉衣香何处。消息竟沉沉,今夜相思几许。秋雨,秋雨,一半因风吹去。(版本一)木叶纷纷归路,残月晓风何处。消息竟沉沉,今夜相思几许。秋雨,秋雨,一半因风吹去。(版本二)",
"content": "黄叶青苔归路,屧粉衣香何处。消息竟沉沉,今夜相思几许。秋雨,秋雨,一半因风吹去。(版本一)\n木叶纷纷归路,残月晓风何处。消息竟沉沉,今夜相思几许。秋雨,秋雨,一半因风吹去。(版本二)",
"type": "写雨,抒情,思念,愁绪",
"heat": null,
"createTime": "2019-03-16 01:35:41"
Expand All @@ -16,7 +16,7 @@
"title": "蝶恋花·黄菊开时伤聚散",
"dynasty": "宋代",
"author": "晏几道",
"content": "黄菊开时伤聚散。曾记花前,共说深深愿。重见金英人未见。相思一夜天涯远。罗带同心闲结遍。带易成双,人恨成双晚。欲写彩笺书别怨。泪痕早已先书满。",
"content": "黄菊开时伤聚散。曾记花前,共说深深愿。重见金英人未见。相思一夜天涯远。\n罗带同心闲结遍。带易成双,人恨成双晚。欲写彩笺书别怨。泪痕早已先书满。",
"type": "菊花,离别,相思",
"heat": 0,
"createTime": "2019-03-15 01:35:41"
Expand All @@ -25,7 +25,7 @@
"title": "逢病军人",
"dynasty": "唐代",
"author": "卢纶",
"content": "行多有病住无粮,万里还乡未到乡。蓬鬓哀吟长城下,不堪秋气入金疮。",
"content": "行多有病住无粮,万里还乡未到乡。\n蓬鬓哀吟长城下,不堪秋气入金疮。",
"type": "战争,军人,伤怀",
"heat": 66,
"createTime": null
Expand All @@ -34,7 +34,7 @@
"title": "菩萨蛮·风帘燕舞莺啼柳",
"dynasty": "唐代",
"author": "牛峤",
"content": "风帘燕舞莺啼柳,妆台约鬓低纤手。钗重髻盘珊,一枝红牡丹。门前行乐客,白马嘶春色。故故坠金鞭,回头应眼穿。",
"content": "风帘燕舞莺啼柳,妆台约鬓低纤手。钗重髻盘珊,一枝红牡丹。\n门前行乐客,白马嘶春色。故故坠金鞭,回头应眼穿。",
"type": "写人,爱情",
"heat": 15,
"createTime": "2019-03-13 01:35:41"
Expand All @@ -52,7 +52,7 @@
"title": "渡江云·晴岚低楚甸",
"dynasty": "宋代",
"author": "周邦彦",
"content": "晴岚低楚甸,暖回雁翼,阵势起平沙。骤惊春在眼,借问何时,委曲到山家。涂香晕色,盛粉饰、争作妍华。千万丝、陌头杨柳,渐渐可藏鸦。堪嗟。清江东注,画舸西流,指长安日下。愁宴阑、风翻旗尾,潮溅乌纱。今宵正对初弦月,傍水驿、深舣蒹葭。沉恨处,时时自剔灯花。",
"content": "晴岚低楚甸,暖回雁翼,阵势起平沙。骤惊春在眼,借问何时,委曲到山家。涂香晕色,盛粉饰、争作妍华。千万丝、陌头杨柳,渐渐可藏鸦。\n堪嗟。清江东注,画舸西流,指长安日下。愁宴阑、风翻旗尾,潮溅乌纱。今宵正对初弦月,傍水驿、深舣蒹葭。沉恨处,时时自剔灯花。",
"type": "春天,山水,羁旅,抒怀",
"heat": 15,
"createTime": "2019-03-11 01:35:41"
Expand All @@ -61,7 +61,7 @@
"title": "丑奴儿·书博山道中壁",
"dynasty": "宋代",
"author": "辛弃疾",
"content": "少年不识愁滋味,爱上层楼。爱上层楼,为赋新词强说愁。而今识尽愁滋味,欲说还休。欲说还休,却道天凉好个秋。",
"content": "少年不识愁滋味,爱上层楼。爱上层楼,为赋新词强说愁。\n而今识尽愁滋味,欲说还休。欲说还休,却道天凉好个秋。",
"type": "宋词三百首,宋词精选,婉约,写人,少年,抒怀,愁苦",
"heat": 3803,
"createTime": "2019-03-10 01:35:41"
Expand All @@ -70,7 +70,7 @@
"title": "谪居粮绝请学于农将田南山咏言寄怀",
"dynasty": "明代",
"author": "王守仁",
"content": "谪居履在陈,从者有温见。山荒聊可田,钱镈还易办。夷俗多火耕,仿习亦颇便。及兹春未深,数亩犹足佃。岂徒实口腹,且以理荒宴。遗穗及乌雀,贫寡发余羡。出耒在明晨,山寒易霜霰。",
"content": "谪居履在陈,从者有温见。\n山荒聊可田,钱镈还易办。\n夷俗多火耕,仿习亦颇便。\n及兹春未深,数亩犹足佃。\n岂徒实口腹,且以理荒宴。\n遗穗及乌雀,贫寡发余羡。\n出耒在明晨,山寒易霜霰。",
"type": "学习,农事,抒情",
"heat": 12,
"createTime": "2019-03-09 01:35:41"
Expand Down
2 changes: 1 addition & 1 deletion docs/0.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/1.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/10.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/11.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/12.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/13.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/14.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/15.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/16.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/17.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/18.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/19.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/2.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/20.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/21.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/22.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/23.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/24.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/25.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/26.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/27.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/28.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/29.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/3.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/30.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/31.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/32.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/33.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/34.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/35.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/36.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/37.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/38.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/39.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/4.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/40.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/41.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/42.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/45.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/5.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/6.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/7.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/8.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/9.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/app.233ed18.js → docs/app.75201c3.js

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions docs/data-1.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"title": "如梦令·黄叶青苔归路",
"dynasty": "清代",
"author": "纳兰性德",
"content": "黄叶青苔归路,屧粉衣香何处。消息竟沉沉,今夜相思几许。秋雨,秋雨,一半因风吹去。(版本一)木叶纷纷归路,残月晓风何处。消息竟沉沉,今夜相思几许。秋雨,秋雨,一半因风吹去。(版本二)",
"content": "黄叶青苔归路,屧粉衣香何处。消息竟沉沉,今夜相思几许。秋雨,秋雨,一半因风吹去。(版本一)\n木叶纷纷归路,残月晓风何处。消息竟沉沉,今夜相思几许。秋雨,秋雨,一半因风吹去。(版本二)",
"type": "写雨,抒情,思念,愁绪",
"heat": null,
"createTime": "2019-03-16 01:35:41"
Expand All @@ -16,7 +16,7 @@
"title": "蝶恋花·黄菊开时伤聚散",
"dynasty": "宋代",
"author": "晏几道",
"content": "黄菊开时伤聚散。曾记花前,共说深深愿。重见金英人未见。相思一夜天涯远。罗带同心闲结遍。带易成双,人恨成双晚。欲写彩笺书别怨。泪痕早已先书满。",
"content": "黄菊开时伤聚散。曾记花前,共说深深愿。重见金英人未见。相思一夜天涯远。\n罗带同心闲结遍。带易成双,人恨成双晚。欲写彩笺书别怨。泪痕早已先书满。",
"type": "菊花,离别,相思",
"heat": 0,
"createTime": "2019-03-15 01:35:41"
Expand All @@ -25,7 +25,7 @@
"title": "逢病军人",
"dynasty": "唐代",
"author": "卢纶",
"content": "行多有病住无粮,万里还乡未到乡。蓬鬓哀吟长城下,不堪秋气入金疮。",
"content": "行多有病住无粮,万里还乡未到乡。\n蓬鬓哀吟长城下,不堪秋气入金疮。",
"type": "战争,军人,伤怀",
"heat": 66,
"createTime": null
Expand All @@ -34,7 +34,7 @@
"title": "菩萨蛮·风帘燕舞莺啼柳",
"dynasty": "唐代",
"author": "牛峤",
"content": "风帘燕舞莺啼柳,妆台约鬓低纤手。钗重髻盘珊,一枝红牡丹。门前行乐客,白马嘶春色。故故坠金鞭,回头应眼穿。",
"content": "风帘燕舞莺啼柳,妆台约鬓低纤手。钗重髻盘珊,一枝红牡丹。\n门前行乐客,白马嘶春色。故故坠金鞭,回头应眼穿。",
"type": "写人,爱情",
"heat": 15,
"createTime": "2019-03-13 01:35:41"
Expand All @@ -52,7 +52,7 @@
"title": "渡江云·晴岚低楚甸",
"dynasty": "宋代",
"author": "周邦彦",
"content": "晴岚低楚甸,暖回雁翼,阵势起平沙。骤惊春在眼,借问何时,委曲到山家。涂香晕色,盛粉饰、争作妍华。千万丝、陌头杨柳,渐渐可藏鸦。堪嗟。清江东注,画舸西流,指长安日下。愁宴阑、风翻旗尾,潮溅乌纱。今宵正对初弦月,傍水驿、深舣蒹葭。沉恨处,时时自剔灯花。",
"content": "晴岚低楚甸,暖回雁翼,阵势起平沙。骤惊春在眼,借问何时,委曲到山家。涂香晕色,盛粉饰、争作妍华。千万丝、陌头杨柳,渐渐可藏鸦。\n堪嗟。清江东注,画舸西流,指长安日下。愁宴阑、风翻旗尾,潮溅乌纱。今宵正对初弦月,傍水驿、深舣蒹葭。沉恨处,时时自剔灯花。",
"type": "春天,山水,羁旅,抒怀",
"heat": 15,
"createTime": "2019-03-11 01:35:41"
Expand All @@ -61,7 +61,7 @@
"title": "丑奴儿·书博山道中壁",
"dynasty": "宋代",
"author": "辛弃疾",
"content": "少年不识愁滋味,爱上层楼。爱上层楼,为赋新词强说愁。而今识尽愁滋味,欲说还休。欲说还休,却道天凉好个秋。",
"content": "少年不识愁滋味,爱上层楼。爱上层楼,为赋新词强说愁。\n而今识尽愁滋味,欲说还休。欲说还休,却道天凉好个秋。",
"type": "宋词三百首,宋词精选,婉约,写人,少年,抒怀,愁苦",
"heat": 3803,
"createTime": "2019-03-10 01:35:41"
Expand All @@ -70,7 +70,7 @@
"title": "谪居粮绝请学于农将田南山咏言寄怀",
"dynasty": "明代",
"author": "王守仁",
"content": "谪居履在陈,从者有温见。山荒聊可田,钱镈还易办。夷俗多火耕,仿习亦颇便。及兹春未深,数亩犹足佃。岂徒实口腹,且以理荒宴。遗穗及乌雀,贫寡发余羡。出耒在明晨,山寒易霜霰。",
"content": "谪居履在陈,从者有温见。\n山荒聊可田,钱镈还易办。\n夷俗多火耕,仿习亦颇便。\n及兹春未深,数亩犹足佃。\n岂徒实口腹,且以理荒宴。\n遗穗及乌雀,贫寡发余羡。\n出耒在明晨,山寒易霜霰。",
"type": "学习,农事,抒情",
"heat": 12,
"createTime": "2019-03-09 01:35:41"
Expand Down
Loading

0 comments on commit 6cf4a42

Please sign in to comment.