From 5e73d562bae941a7658c3c13fdb585461f1a24e4 Mon Sep 17 00:00:00 2001 From: zhongshujie <2862698242@qq.com> Date: 星期一, 28 四月 2025 21:21:07 +0800 Subject: [PATCH] Merge branch 'master' of http://182.92.203.7:2001/r/wyyDatabase --- src/views/home/components/searchBox.vue | 50 +++++++++++++++++++++++++++++++++++--------------- 1 files changed, 35 insertions(+), 15 deletions(-) diff --git a/src/views/home/components/searchBox.vue b/src/views/home/components/searchBox.vue index 1087fca..86497ad 100644 --- a/src/views/home/components/searchBox.vue +++ b/src/views/home/components/searchBox.vue @@ -15,7 +15,7 @@ </el-select> <div class="inputBox"> <input type="text" v-model="searchText" class="search-input" /> - <div class="searchBtn">鎼滅储</div> + <div class="searchBtn" @click="handleSearch()">鎼滅储</div> </div> </div> </template> @@ -23,25 +23,42 @@ <script> export default { name: "SearchBox", + props: { + // 鎺ユ敹澶栭儴浼犲叆鐨勯�夐」 + options: { + type: Array, + default: () => [ + { value: "all", label: "鍏ㄩ儴" }, + { value: "name", label: "鏍囬" }, + { value: "author", label: "浣滆��" }, + { value: "year", label: "骞翠唤" }, + { value: "keyWords", label: "鍏抽敭璇�" }, + { value: "abstract", label: "鎽樿" }, + { value: "source", label: "鏉ユ簮" }, + ], + searchFun: { + type: Function, + default: () => {}, + }, + }, + }, data() { return { searchText: "", // 杈撳叆妗嗗唴瀹� - selectedType: "", // 涓嬫媺妗嗛�変腑鍊� - options: [ - // 涓嬫媺閫夐」 - { value: "all", label: "鍏ㄩ儴" }, - { value: "name", label: "鍚嶇О" }, - { value: "id", label: "ID" }, - { value: "code", label: "缂栫爜" }, - ], + selectedType: "all", // 涓嬫媺妗嗛�変腑鍊� }; }, methods: { // 鎼滅储澶勭悊 handleSearch() { + // 鎵惧埌閫変腑鐨勯�夐」鐨刲abel + const selectedOption = this.options.find(option => option.value === this.selectedType); + const selectedLabel = selectedOption ? selectedOption.label : ''; + console.log(selectedLabel,"001") this.$emit("search", { text: this.searchText, type: this.selectedType, + label: selectedLabel }); }, }, @@ -52,22 +69,25 @@ /* 缁勫悎鏍峰紡 */ .search-container { max-width: 800px; - margin: 20px 0; display: flex; + align-items: center; + background-color: #fff; } /* 杈撳叆妗嗘牱寮� */ .search-input { + width: 100%; + } .inputBox { - border: 1px solid #B9A587; + border: 1px solid #b9a587; height: 38px; width: 400px; display: flex; justify-content: space-between; + background-color: transparent !important; align-items: center; - margin-top: 13px; padding-right: 5px; border-radius: 5px; border-top-left-radius: 0; @@ -79,6 +99,7 @@ width: 70px; height: 30px; background-color: #937950; + border-radius: 5px; margin-left: 10px; cursor: pointer; font-size: 14px; @@ -96,10 +117,9 @@ .el-select /deep/ .el-input__inner { border-top-right-radius: 0; border-bottom-right-radius: 0; - border: 1px solid #B9A587; - + border: 1px solid #b9a587; + background-color: transparent; border-right: none; - } .el-input-group__prepend { -- Gitblit v1.9.1