zhongshujie
4 天以前 2b223db62940c58c9f2686558972a476869bb59d
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,17 +23,25 @@
<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: "来源" },
      ],
    },
  },
  data() {
    return {
      searchText: "", // 输入框内容
      selectedType: "", // 下拉框选中值
      options: [
        // 下拉选项
        { value: "all", label: "全部" },
        { value: "name", label: "名称" },
        { value: "id", label: "ID" },
        { value: "code", label: "编码" },
      ],
    };
  },
  methods: {
@@ -52,8 +60,8 @@
/* 组合样式 */
.search-container {
  max-width: 800px;
  margin: 20px 0;
  display: flex;
  align-items: center;
}
/* 输入框样式 */
@@ -67,7 +75,6 @@
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 13px;
  padding-right: 5px;
  border-radius: 5px;
  border-top-left-radius: 0;