|
@@ -51,13 +51,13 @@
|
|
|
</div>
|
|
|
<div ref="sidebarMenu" class="sidebar">
|
|
|
<div
|
|
|
- v-for="item in sidebarIconList"
|
|
|
- :key="item.icon"
|
|
|
- :title="item.title"
|
|
|
+ v-for="{ icon, title, handle, param } in sidebarIconList"
|
|
|
+ :key="icon"
|
|
|
+ :title="title"
|
|
|
class="sidebar-icon"
|
|
|
- @click="handleSidebarClick(item)"
|
|
|
+ @click="handleSidebarClick(handle, param)"
|
|
|
>
|
|
|
- <SvgIcon :icon-class="`sidebar-${item.icon}`" size="24" />
|
|
|
+ <SvgIcon :icon-class="`sidebar-${icon}`" size="24" />
|
|
|
</div>
|
|
|
</div>
|
|
|
<el-drawer
|
|
@@ -231,15 +231,16 @@ export default {
|
|
|
componentId: 'WHOLE',
|
|
|
},
|
|
|
sidebarIconList: [
|
|
|
- { icon: 'search', title: '搜索', handle: '' },
|
|
|
- { icon: 'mindmap', title: '思维导图', handle: 'openMindMap' },
|
|
|
- { icon: 'connect', title: '连接', handle: '' },
|
|
|
- { icon: 'audio', title: '音频', handle: 'openDrawer', type: '1' },
|
|
|
- { icon: 'image', title: '图片', handle: 'openDrawer', type: '0' },
|
|
|
- { icon: 'video', title: '视频', handle: 'openDrawer', type: '2' },
|
|
|
- { icon: 'text', title: '文本', handle: '' },
|
|
|
- { icon: 'collect', title: '收藏', handle: '' },
|
|
|
- { icon: 'setting', title: '设置', handle: '' },
|
|
|
+ { icon: 'search', title: '搜索', handle: '', param: {} },
|
|
|
+ { icon: 'mindmap', title: '思维导图', handle: 'openMindMap', param: {} },
|
|
|
+ { icon: 'connect', title: '连接', handle: '', param: {} },
|
|
|
+ { icon: 'audio', title: '音频', handle: 'openDrawer', param: { type: '1' } },
|
|
|
+ { icon: 'image', title: '图片', handle: 'openDrawer', param: { type: '0' } },
|
|
|
+ { icon: 'video', title: '视频', handle: 'openDrawer', param: { type: '2' } },
|
|
|
+ { icon: 'text', title: '文本', handle: '', param: {} },
|
|
|
+ { icon: 'file', title: '文件', handle: '', param: {} },
|
|
|
+ { icon: 'collect', title: '收藏', handle: '', param: {} },
|
|
|
+ { icon: 'setting', title: '设置', handle: '', param: {} },
|
|
|
],
|
|
|
visibleMindMap: false,
|
|
|
isChildDataLoad: false,
|
|
@@ -426,14 +427,10 @@ export default {
|
|
|
* @param {string} handle - 处理函数名
|
|
|
* @param {any} param - 处理函数参数
|
|
|
*/
|
|
|
- handleSidebarClick(item) {
|
|
|
- let handle = item.handle;
|
|
|
- if (typeof this[handle] === 'function') {
|
|
|
- this[handle](item.type);
|
|
|
+ handleSidebarClick(handle, param) {
|
|
|
+ if (typeof handle === 'string' && handle && typeof this[handle] === 'function') {
|
|
|
+ this[handle](param);
|
|
|
}
|
|
|
- // if (typeof handle === 'string' && handle && typeof this[handle] === 'function') {
|
|
|
- // this[handle](param);
|
|
|
- // }
|
|
|
},
|
|
|
|
|
|
openMindMap() {
|
|
@@ -475,8 +472,12 @@ export default {
|
|
|
};
|
|
|
}
|
|
|
},
|
|
|
- // 打开抽屉并初始化加载
|
|
|
- openDrawer(type) {
|
|
|
+ /**
|
|
|
+ * 打开抽屉并初始化加载
|
|
|
+ * @param {Object} param - 抽屉参数
|
|
|
+ * @param {string} param.type - 抽屉类型(0: 图片, 1: 音频, 2: 视频)
|
|
|
+ */
|
|
|
+ openDrawer({ type }) {
|
|
|
if (this.drawerType === type) {
|
|
|
this.drawerType = '';
|
|
|
return;
|