فهرست منبع

cards移至frame/parts中

lrf402788946 5 سال پیش
والد
کامیت
bc6dfebc0f
1فایلهای تغییر یافته به همراه42 افزوده شده و 0 حذف شده
  1. 42 0
      parts/cards.vue

+ 42 - 0
parts/cards.vue

@@ -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>