mirror of
https://github.com/purocean/yn.git
synced 2026-09-24 15:46:02 +08:00
feat: HTML 小工具支持无边框
This commit is contained in:
@@ -242,6 +242,13 @@ function run (type) {
|
||||
</div>
|
||||
```
|
||||
|
||||
如果没有标题,将没有外部边框装饰
|
||||
|
||||
```html
|
||||
<!-- --applet-- -->
|
||||
<button onclick="ctx.ui.useToast().show(`info`, `HELLOWORLD!`)">HELLO</button>
|
||||
```
|
||||
|
||||
## ECharts 图形
|
||||
|
||||
Js 代码块第一行包含以 `--echarts--` 字符串会被解析成 ECharts 图形,示例如下
|
||||
|
||||
@@ -28,25 +28,31 @@ const MarkdownItPlugin = (md: Markdown) => {
|
||||
${code}
|
||||
`
|
||||
|
||||
const iframe = h(IFrame, {
|
||||
html,
|
||||
debounce: 1000,
|
||||
globalStyle: true,
|
||||
onLoad (iframe: HTMLIFrameElement) {
|
||||
const win = iframe.contentWindow as any
|
||||
win.appletId = appletId
|
||||
win.init?.()
|
||||
win.resize()
|
||||
},
|
||||
iframeProps: {
|
||||
class: 'applet-iframe',
|
||||
height: '20px',
|
||||
}
|
||||
})
|
||||
|
||||
if (!appletTitle) {
|
||||
return iframe
|
||||
}
|
||||
|
||||
return h('fieldset', {}, [
|
||||
h('legend', {}, `Applet: ${appletTitle}`),
|
||||
h('div',
|
||||
{ class: 'applet' },
|
||||
h(IFrame, {
|
||||
html,
|
||||
debounce: 1000,
|
||||
globalStyle: true,
|
||||
onLoad (iframe: HTMLIFrameElement) {
|
||||
const win = iframe.contentWindow as any
|
||||
win.appletId = appletId
|
||||
win.init?.()
|
||||
win.resize()
|
||||
},
|
||||
iframeProps: {
|
||||
class: 'applet-iframe',
|
||||
height: '20px',
|
||||
}
|
||||
}),
|
||||
iframe,
|
||||
)
|
||||
]) as any
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user