Skip to content

Commit 062da36

Browse files
committed
添加Grid toolbars vue路由简单组件
1 parent c50aa49 commit 062da36

File tree

9 files changed

+355
-12
lines changed

9 files changed

+355
-12
lines changed

public/app.js

Lines changed: 155 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1228,6 +1228,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
12281228
//
12291229
//
12301230
//
1231+
//
12311232

12321233

12331234

@@ -3096,6 +3097,39 @@ __webpack_require__.r(__webpack_exports__);
30963097

30973098
/***/ }),
30983099

3100+
/***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/widgets/Tools/VueRouteButton.vue?vue&type=script&lang=js&":
3101+
/*!***************************************************************************************************************************************************************************************!*\
3102+
!*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/widgets/Tools/VueRouteButton.vue?vue&type=script&lang=js& ***!
3103+
\***************************************************************************************************************************************************************************************/
3104+
/*! exports provided: default */
3105+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
3106+
3107+
"use strict";
3108+
__webpack_require__.r(__webpack_exports__);
3109+
//
3110+
//
3111+
//
3112+
//
3113+
//
3114+
//
3115+
//
3116+
//
3117+
//
3118+
//
3119+
//
3120+
//
3121+
//
3122+
//
3123+
//
3124+
//
3125+
/* harmony default export */ __webpack_exports__["default"] = ({
3126+
props: {
3127+
attr: Object
3128+
}
3129+
});
3130+
3131+
/***/ }),
3132+
30993133
/***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/widgets/Transfer.vue?vue&type=script&lang=js&":
31003134
/*!***************************************************************************************************************************************************************************!*\
31013135
!*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/widgets/Transfer.vue?vue&type=script&lang=js& ***!
@@ -27730,7 +27764,8 @@ var render = function() {
2773027764
_vm._l(_vm.attrs.toolbars.right, function(component, index) {
2773127765
return _c(component.componentName, {
2773227766
key: component.componentName + index,
27733-
tag: "component"
27767+
tag: "component",
27768+
attrs: { attr: component }
2773427769
})
2773527770
}),
2773627771
_vm._v(" "),
@@ -29620,6 +29655,53 @@ render._withStripped = true
2962029655

2962129656

2962229657

29658+
/***/ }),
29659+
29660+
/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/widgets/Tools/VueRouteButton.vue?vue&type=template&id=012d95d8&":
29661+
/*!*******************************************************************************************************************************************************************************************************************************!*\
29662+
!*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/widgets/Tools/VueRouteButton.vue?vue&type=template&id=012d95d8& ***!
29663+
\*******************************************************************************************************************************************************************************************************************************/
29664+
/*! exports provided: render, staticRenderFns */
29665+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
29666+
29667+
"use strict";
29668+
__webpack_require__.r(__webpack_exports__);
29669+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
29670+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
29671+
var render = function() {
29672+
var _vm = this
29673+
var _h = _vm.$createElement
29674+
var _c = _vm._self._c || _h
29675+
return _c(
29676+
"router-link",
29677+
{ attrs: { to: _vm.attr.vueRoute ? _vm.attr.vueRoute : "/" } },
29678+
[
29679+
_c(
29680+
"el-button",
29681+
{
29682+
staticClass: "mr-10",
29683+
attrs: {
29684+
type: _vm.attr.type,
29685+
size: _vm.attr.size,
29686+
plain: _vm.attr.plain,
29687+
round: _vm.attr.round,
29688+
circle: _vm.attr.circle,
29689+
disabled: _vm.attr.disabled,
29690+
icon: _vm.attr.icon,
29691+
autofocus: _vm.attr.autofocus
29692+
}
29693+
},
29694+
[_vm._v(_vm._s(_vm.attr.content))]
29695+
)
29696+
],
29697+
1
29698+
)
29699+
}
29700+
var staticRenderFns = []
29701+
render._withStripped = true
29702+
29703+
29704+
2962329705
/***/ }),
2962429706

2962529707
/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/widgets/Transfer.vue?vue&type=template&id=0b1d5794&":
@@ -30132,6 +30214,7 @@ __webpack_require__.r(__webpack_exports__);
3013230214
/* harmony import */ var _components_widgets_Actions_EditAction__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./components/widgets/Actions/EditAction */ "./resources/js/components/widgets/Actions/EditAction.vue");
3013330215
/* harmony import */ var _components_widgets_Actions_DeleteAction__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./components/widgets/Actions/DeleteAction */ "./resources/js/components/widgets/Actions/DeleteAction.vue");
3013430216
/* harmony import */ var _components_widgets_Tools_Create__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./components/widgets/Tools/Create */ "./resources/js/components/widgets/Tools/Create.vue");
30217+
/* harmony import */ var _components_widgets_Tools_VueRouteButton__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ./components/widgets/Tools/VueRouteButton */ "./resources/js/components/widgets/Tools/VueRouteButton.vue");
3013530218

3013630219

3013730220

@@ -30200,7 +30283,9 @@ vue__WEBPACK_IMPORTED_MODULE_0___default.a.component('EditAction', _components_w
3020030283
vue__WEBPACK_IMPORTED_MODULE_0___default.a.component('DeleteAction', _components_widgets_Actions_DeleteAction__WEBPACK_IMPORTED_MODULE_32__["default"]); //Tools
3020130284

3020230285

30286+
3020330287
vue__WEBPACK_IMPORTED_MODULE_0___default.a.component('GridCreateButton', _components_widgets_Tools_Create__WEBPACK_IMPORTED_MODULE_33__["default"]);
30288+
vue__WEBPACK_IMPORTED_MODULE_0___default.a.component('VueRouteButton', _components_widgets_Tools_VueRouteButton__WEBPACK_IMPORTED_MODULE_34__["default"]);
3020430289

3020530290
/***/ }),
3020630291

@@ -33177,6 +33262,75 @@ __webpack_require__.r(__webpack_exports__);
3317733262

3317833263

3317933264

33265+
/***/ }),
33266+
33267+
/***/ "./resources/js/components/widgets/Tools/VueRouteButton.vue":
33268+
/*!******************************************************************!*\
33269+
!*** ./resources/js/components/widgets/Tools/VueRouteButton.vue ***!
33270+
\******************************************************************/
33271+
/*! exports provided: default */
33272+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
33273+
33274+
"use strict";
33275+
__webpack_require__.r(__webpack_exports__);
33276+
/* harmony import */ var _VueRouteButton_vue_vue_type_template_id_012d95d8___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./VueRouteButton.vue?vue&type=template&id=012d95d8& */ "./resources/js/components/widgets/Tools/VueRouteButton.vue?vue&type=template&id=012d95d8&");
33277+
/* harmony import */ var _VueRouteButton_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./VueRouteButton.vue?vue&type=script&lang=js& */ "./resources/js/components/widgets/Tools/VueRouteButton.vue?vue&type=script&lang=js&");
33278+
/* empty/unused harmony star reexport *//* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");
33279+
33280+
33281+
33282+
33283+
33284+
/* normalize component */
33285+
33286+
var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
33287+
_VueRouteButton_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
33288+
_VueRouteButton_vue_vue_type_template_id_012d95d8___WEBPACK_IMPORTED_MODULE_0__["render"],
33289+
_VueRouteButton_vue_vue_type_template_id_012d95d8___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
33290+
false,
33291+
null,
33292+
null,
33293+
null
33294+
33295+
)
33296+
33297+
/* hot reload */
33298+
if (false) { var api; }
33299+
component.options.__file = "resources/js/components/widgets/Tools/VueRouteButton.vue"
33300+
/* harmony default export */ __webpack_exports__["default"] = (component.exports);
33301+
33302+
/***/ }),
33303+
33304+
/***/ "./resources/js/components/widgets/Tools/VueRouteButton.vue?vue&type=script&lang=js&":
33305+
/*!*******************************************************************************************!*\
33306+
!*** ./resources/js/components/widgets/Tools/VueRouteButton.vue?vue&type=script&lang=js& ***!
33307+
\*******************************************************************************************/
33308+
/*! exports provided: default */
33309+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
33310+
33311+
"use strict";
33312+
__webpack_require__.r(__webpack_exports__);
33313+
/* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_VueRouteButton_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../../../node_modules/babel-loader/lib??ref--4-0!../../../../../node_modules/vue-loader/lib??vue-loader-options!./VueRouteButton.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/widgets/Tools/VueRouteButton.vue?vue&type=script&lang=js&");
33314+
/* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_VueRouteButton_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
33315+
33316+
/***/ }),
33317+
33318+
/***/ "./resources/js/components/widgets/Tools/VueRouteButton.vue?vue&type=template&id=012d95d8&":
33319+
/*!*************************************************************************************************!*\
33320+
!*** ./resources/js/components/widgets/Tools/VueRouteButton.vue?vue&type=template&id=012d95d8& ***!
33321+
\*************************************************************************************************/
33322+
/*! exports provided: render, staticRenderFns */
33323+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
33324+
33325+
"use strict";
33326+
__webpack_require__.r(__webpack_exports__);
33327+
/* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_VueRouteButton_vue_vue_type_template_id_012d95d8___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../../../node_modules/vue-loader/lib??vue-loader-options!./VueRouteButton.vue?vue&type=template&id=012d95d8& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/widgets/Tools/VueRouteButton.vue?vue&type=template&id=012d95d8&");
33328+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_VueRouteButton_vue_vue_type_template_id_012d95d8___WEBPACK_IMPORTED_MODULE_0__["render"]; });
33329+
33330+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_VueRouteButton_vue_vue_type_template_id_012d95d8___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
33331+
33332+
33333+
3318033334
/***/ }),
3318133335

3318233336
/***/ "./resources/js/components/widgets/Transfer.vue":

public/mix-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"/app.js": "/app.js?id=7fafe2e9073cecc0d058",
2+
"/app.js": "/app.js?id=19683e44f081c8d98093",
33
"/manifest.js": "/manifest.js?id=d9708e48a6c10ccee4bb",
44
"/vendor.js": "/vendor.js?id=f4679ac178c0e413cb28"
55
}

resources/js/components.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,6 @@ Vue.component('DeleteAction', DeleteAction);
8686

8787
//Tools
8888
import GridCreateButton from './components/widgets/Tools/Create'
89-
Vue.component('GridCreateButton', GridCreateButton);
89+
import VueRouteButton from './components/widgets/Tools/VueRouteButton'
90+
Vue.component('GridCreateButton', GridCreateButton);
91+
Vue.component('VueRouteButton', VueRouteButton);

resources/js/components/grid/Table.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
v-for="(component, index) in attrs.toolbars.right"
3030
:key="component.componentName + index"
3131
:is="component.componentName"
32+
:attr="component"
3233
/>
3334
<el-divider
3435
direction="vertical"
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<template>
2+
<router-link :to="attr.vueRoute ? attr.vueRoute : '/'">
3+
<el-button
4+
:type="attr.type"
5+
:size="attr.size"
6+
:plain="attr.plain"
7+
:round="attr.round"
8+
:circle="attr.circle"
9+
:disabled="attr.disabled"
10+
:icon="attr.icon"
11+
:autofocus="attr.autofocus"
12+
class="mr-10"
13+
>{{ attr.content }}</el-button
14+
>
15+
</router-link>
16+
</template>
17+
<script>
18+
export default {
19+
props: {
20+
attr: Object
21+
}
22+
};
23+
</script>

src/Components/Attrs/Button.php

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
<?php
2+
3+
namespace SmallRuralDog\Admin\Components\Attrs;
4+
5+
trait Button
6+
{
7+
protected $content;
8+
protected $size;
9+
protected $type;
10+
protected $plain = false;
11+
protected $round = false;
12+
protected $circle = false;
13+
protected $disabled = false;
14+
protected $icon;
15+
protected $autofocus = false;
16+
17+
/**
18+
* @param mixed $content
19+
* @return $this
20+
*/
21+
public function content($content)
22+
{
23+
$this->content = $content;
24+
return $this;
25+
}
26+
27+
28+
29+
/**
30+
* @param mixed $size
31+
* @return $this
32+
*/
33+
public function size($size)
34+
{
35+
$this->size = $size;
36+
return $this;
37+
}
38+
39+
/**
40+
* @param mixed $type
41+
* @return $this
42+
*/
43+
public function type($type)
44+
{
45+
$this->type = $type;
46+
return $this;
47+
}
48+
49+
/**
50+
* @param bool $plain
51+
* @return $this
52+
*/
53+
public function plain(bool $plain)
54+
{
55+
$this->plain = $plain;
56+
return $this;
57+
}
58+
59+
/**
60+
* @param bool $round
61+
* @return $this
62+
*/
63+
public function round(bool $round)
64+
{
65+
$this->round = $round;
66+
return $this;
67+
}
68+
69+
/**
70+
* @param bool $circle
71+
* @return $this
72+
*/
73+
public function circle(bool $circle)
74+
{
75+
$this->circle = $circle;
76+
return $this;
77+
}
78+
79+
/**
80+
* @param bool $disabled
81+
* @return $this
82+
*/
83+
public function disabled(bool $disabled)
84+
{
85+
$this->disabled = $disabled;
86+
return $this;
87+
}
88+
89+
/**
90+
* @param mixed $icon
91+
* @return $this
92+
*/
93+
public function icon($icon)
94+
{
95+
$this->icon = $icon;
96+
return $this;
97+
}
98+
99+
/**
100+
* @param bool $autofocus
101+
* @return $this
102+
*/
103+
public function autofocus(bool $autofocus)
104+
{
105+
$this->autofocus = $autofocus;
106+
return $this;
107+
}
108+
109+
110+
111+
112+
113+
114+
115+
}

src/Grid/Concerns/HasActions.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,11 @@ public function hideDeleteAction()
6262
/**
6363
* 添加自定义Action
6464
* @param $action
65-
* @param bool $prepend
6665
* @return $this
6766
*/
68-
public function add($action, $prepend = false)
67+
public function add($action)
6968
{
70-
if ($prepend) {
71-
$this->addActions = collect($this->addActions)->prepend($action)->all();
72-
} else {
73-
$this->addActions = collect($this->addActions)->push($action)->all();
74-
}
75-
69+
$this->addActions = collect($this->addActions)->push($action)->all();
7670
return $this;
7771
}
7872

0 commit comments

Comments
 (0)