<template>
  <el-space class="flex items-center">
    <el-input v-model="where.keywords" :placeholder="`${$t('searchKeywords')}...`" :suffix-icon="Search" @change="reload"/>
  </el-space>
</template>

<script setup lang="ts">
import { Search } from '@element-plus/icons-vue'
import type {CmsArticle} from "~/api/cms/cmsArticle/model";

const i18n = useI18n();

const props = withDefaults(
    defineProps<{
      title?: string;
      desc?: string;
      buyUrl?: string;
      form?: CmsArticle;
      value?: number;
    }>(),
    {}
);

const emit = defineEmits<{
  (e: 'done', where: any): void
}>()

// 搜索表单
const where = reactive<any>({
  keywords: '',
  page: 1,
  limit: 20,
  status: 0,
  parentId: undefined,
  categoryId: undefined,
  lang: i18n.locale.value
});

const reload = () => {
  navigateTo(`/search/${where.keywords}`)
}

</script>
<style scoped lang="less">
</style>
