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