$mol
搜索
⌘ K
文档
演练场
对比
生态系统
关于
ZH
插件
Getting Started
介绍
心智模型
快速上手
从 TypeScript 到 view.tree
项目结构
工具链
Essentials
安装
视图
状态与响应式
路由
渲染
测试
部署
故障排查
Data
数据获取
数据模式
Giper Baza
More
展示
来自 React、Vue 和 Svelte
食谱
Advanced
插件
模块元数据
离线
幽灵视图
About
常见问题
团队
发布
API
$mol_button_major
$mol_button_minor
$mol_string
$mol_number
$mol_text
$mol_paragraph
$mol_list
$mol_row
$mol_link
$mol_check
$mol_switch
$mol_select
$mol_scroll
$mol_page
$mol_pick
插件
插件
是没有自己 DOM 元素的组件。它不渲染到页面中,而是把行为附加到宿主它的那个组件的元素上——很像一个指令。你在 view.tree 里的
plugins
/
下列出插件;它们与视图并肩运行,但从不出现在其
sub
中。
1
$my_app
$mol_view
2
plugins
/
3
<=
Theme
$mol_theme_auto
4
<=
Search_key
$mol_hotkey
5
key
*
6
K
?
<=>
open_search
?
7
sub
/
8
<=
Content
$my_content
因为插件共享其宿主的元素,它可以给那个元素添加事件监听器、属性或响应式副作用,而无需用额外的标记把它包起来。
你会经常用到的插件
$mol_hotkey
——绑定键盘快捷键。
key
*
escape
?
<
=
>
close
?
在 Escape 时运行
close
;设置
mod_ctrl
true
以要求 Ctrl/⌘。
$mol_theme_auto
——为宿主子树应用亮/暗主题。
$mol_nav
——在一列组件间用方向键导航(
keys_y
、
current_y
)。
$mol_speech
——语音识别输入。
编写一个
插件扩展
$mol_plugin
(它本身就是无元素的),通常把一个
event
接到一个处理器:
1
$my_autosave
$mol_plugin
2
event
*
3
^
4
input
?
<=>
save
?
null
通过某个视图的
plugins
/
列表把它附加到该视图,它就会增强该视图的元素。
在 GitHub 上编辑此页
这有帮助吗?
是
否
上一页
食谱
下一页
模块元数据
本页内容
你会经常用到的插件
编写一个
Type to search the documentation.