mirror of
https://github.com/jumpserver/lina.git
synced 2025-10-21 15:39:36 +00:00
[Update] 添加lodash到全局
This commit is contained in:
@@ -10,6 +10,10 @@ module.exports = {
|
||||
es6: true
|
||||
},
|
||||
extends: ['plugin:vue/recommended', 'eslint:recommended'],
|
||||
globals: {
|
||||
window: true,
|
||||
_: true
|
||||
},
|
||||
|
||||
// add your custom rules here
|
||||
// it is base on https://github.com/vuejs/eslint-config-vue
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div :class="grouped ? 'el-button-group' : ''">
|
||||
<el-button v-for="item in actions" :key="item.name" :size="size" v-bind="item" @click="handleClick(item.name)">
|
||||
<i v-if="item.has" :class="'fa ' + item.fa" />{{ item.title }}
|
||||
<i v-if="item.fa" :class="'fa ' + item.fa" />{{ item.title }}
|
||||
</el-button>
|
||||
<el-dropdown v-if="moreActions.length > 0" trigger="click" @command="handleClick">
|
||||
<el-button :size="size" class="btn-more-actions">
|
||||
|
@@ -107,11 +107,22 @@ export default {
|
||||
}
|
||||
return validActions
|
||||
},
|
||||
cleanedActions() {
|
||||
const actions = []
|
||||
for (const v of [...this.validActions]) {
|
||||
const action = _.cloneDeep(v)
|
||||
delete action['has']
|
||||
delete action['can']
|
||||
delete action['callback']
|
||||
actions.push(action)
|
||||
}
|
||||
return actions
|
||||
},
|
||||
actions() {
|
||||
return this.validActions.slice(0, 2)
|
||||
return this.cleanedActions.slice(0, 2)
|
||||
},
|
||||
moreActions() {
|
||||
return this.validActions.slice(2, this.validActions.length)
|
||||
return this.cleanedActions.slice(2, this.cleanedActions.length)
|
||||
},
|
||||
namedValidActions() {
|
||||
const actions = {}
|
||||
@@ -127,6 +138,7 @@ export default {
|
||||
methods: {
|
||||
handleActionClick(item) {
|
||||
const action = this.namedValidActions[item]
|
||||
console.log(this.validActions)
|
||||
if (action && action.callback) {
|
||||
const attrs = {
|
||||
reload: this.reload,
|
||||
|
@@ -3,9 +3,12 @@
|
||||
<span slot="title">
|
||||
{{ title }}
|
||||
</span>
|
||||
<span v-if="hasRightSide" slot="headingRightSide">
|
||||
|
||||
<template #headingRightSide>
|
||||
<span v-if="hasRightSide">
|
||||
<ActionsGroup slot="headingRightSide" :actions="pageActions" />
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<div>
|
||||
<el-tabs v-if="submenu.length > 0" slot="submenu" v-model="activeName" class="page-submenu">
|
||||
|
@@ -42,6 +42,11 @@ Vue.use(VueCookie)
|
||||
|
||||
import service from '@/utils/request'
|
||||
|
||||
// lodash
|
||||
// import _ from 'lodash'
|
||||
window._ = require('lodash')
|
||||
// Vue.set(Vue.prototype, '_', _)
|
||||
|
||||
// if the table component cannot access `this.$axios`, it cannot send request
|
||||
Vue.prototype.$axios = service
|
||||
// 注册全局事件总线
|
||||
|
Reference in New Issue
Block a user