神仙都没用 1 年之前
父节点
当前提交
5a51d07c6d
共有 2 个文件被更改,包括 20 次插入3 次删除
  1. 7 1
      src/modules/user/components/select.vue
  2. 13 2
      src/plugins/view/components/head.vue

+ 7 - 1
src/modules/user/components/select.vue

@@ -97,7 +97,7 @@
 import { useCrud, useForm, useTable } from "@cool-vue/crud";
 import { useCool } from "/@/cool";
 import { type PropType, computed, nextTick, reactive, ref, watch } from "vue";
-import { cloneDeep, isEmpty } from "lodash-es";
+import { cloneDeep, isArray, isEmpty } from "lodash-es";
 import { CircleClose } from "@element-plus/icons-vue";
 
 // 替换你的类型
@@ -271,6 +271,11 @@ function close() {
 	visible.value = false;
 }
 
+// 设置值
+function set(data: Item[] | Item) {
+	list.value = cloneDeep(isArray(data) ? data : [data]);
+}
+
 // 选择
 function select(item?: Item) {
 	// 单选不触发 onSelectionChange 手动设置
@@ -329,6 +334,7 @@ watch(
 );
 
 defineExpose({
+	set,
 	remove,
 	select,
 	selectAll

+ 13 - 2
src/plugins/view/components/head.vue

@@ -1,10 +1,14 @@
 <template>
-	<div class="cl-view-head">
+	<div class="cl-view-head" :class="{ 'is-border': border }">
 		<el-icon class="cl-view-head__back" @click="router.back()">
 			<arrow-left />
 		</el-icon>
 
 		<span class="cl-view-head__title">{{ title }}</span>
+
+		<div class="op">
+			<slot name="op"></slot>
+		</div>
 	</div>
 </template>
 
@@ -14,7 +18,8 @@ import { useCool } from "/@/cool";
 import { ArrowLeft } from "@element-plus/icons-vue";
 
 const props = defineProps({
-	title: String
+	title: String,
+	border: Boolean
 });
 
 const { route, router } = useCool();
@@ -47,6 +52,12 @@ const title = computed(() => props.title || route.query.title);
 	&__title {
 		font-size: 14px;
 		line-height: 1;
+		margin-right: auto;
+	}
+
+	&.is-border {
+		border-bottom: 1px solid var(--el-border-color-light);
+		padding-bottom: 10px;
 	}
 }
 </style>