在左侧列表新增插件
Lesca-Ren opened this issue · 2 comments
Lesca-Ren commented
希望在左侧列表新增插件,首先在项目中找到这个目录,front-end\h5\src\components\core\plugins,然后新增一个js文件,使用render撰写一个组件,然后,在 front-end\h5\src\components\core\plugins\index.js中引用并且注册它
Lesca-Ren commented
入门级做法
- 首先,进入front-end\h5\src\components\core\plugins目录,新建一个JS文件,取名为‘lbp-demo.js’,将plugins下方的任意‘lbp-xxx.js’文件的内容复制到该文件中,这个时候,就新建好了一个组件,同时,修改该组件的name,如下所示
export default {
name: 'lbp-rtables',
...
}
- 然后,在该文件的同级目录下,找到‘index.js’,在'index.js'的开头,导入‘lbp-demo.js’,如下所示:
import LbpDemo from 'core/plugins/lbp-demo'
- 接下来,在pluginList里面使用它,从而新建一个plugin
export const pluginsList = [
{
i18nTitle: {
'en-US': 'Demo',
'zh-CN': '示例'
},
title: '示例',
icon: 'line-chart',
component: LbpDemo,
visible: true,
name: LbpDemo.name
},
...
]
- 最后,这个地方的icon属性可以替换成font awesome里面任意icon中的值,但是要注意,前面的'fa'需省略,component就是刚才我们新建的组件,以上就是添加自定义plugin的步骤
ly525 commented
非常赞 👍👍
感谢撰文,我晚点整理到鲁班的官方文档中