|
@@ -0,0 +1,42 @@
|
|
|
+<template>
|
|
|
+ <div id="cards">
|
|
|
+ <el-card>
|
|
|
+ <template #header>
|
|
|
+ <el-row type="flex">
|
|
|
+ <el-col :span="22">{{ title }}</el-col>
|
|
|
+ <el-col :span="2" style="float:right;text-align:right" v-if="returns">
|
|
|
+ <el-button type="text" @click="toReturns">{{ text }}</el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </template>
|
|
|
+ <slot></slot>
|
|
|
+ </el-card>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import _ from 'lodash';
|
|
|
+export default {
|
|
|
+ name: 'cards',
|
|
|
+ props: {
|
|
|
+ title: { type: String, required: true },
|
|
|
+ returns: null,
|
|
|
+ text: { type: String, default: `返回上一级` },
|
|
|
+ },
|
|
|
+ components: {},
|
|
|
+ data: () => ({}),
|
|
|
+ created() {},
|
|
|
+ computed: {},
|
|
|
+ methods: {
|
|
|
+ toReturns() {
|
|
|
+ if (_.isString(this.returns)) this.$router.push({ path: this.returns });
|
|
|
+ else if (_.isFunction(this.returns)) {
|
|
|
+ let fun = _.get(this, `returns`);
|
|
|
+ fun();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less" scoped></style>
|