123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- <template>
- <div :class="$style.searchrate">
- <a-card :bordered="false" title="个人常用">
- <a-list item-layout="horizontal" :data-source="hotListData">
- <a-list-item slot="renderItem" slot-scope="item, index" @click="click(item)">
- <span :class="$style.num">{{ index + 1 }}</span>
- <span>{{ item }}</span>
- </a-list-item>
- </a-list>
- </a-card>
- </div>
- </template>
- <script>
- import KmKnowledageService from '../km-knowledage-service'
- import components from './_import-components/km-fullsearch-rate-import'
- export default {
- name: 'KmFullsearchRate',
- components,
- data() {
- return {
- hotListData: [],
- }
- },
- mounted() {
- this.getHotList()
- },
- methods: {
- getHotList() {
- KmKnowledageService.getHotserch().then((res) => {
- if (res.data.length > 0) {
- res.data.forEach((item, index) => {
- if (item === '请输入搜索内容') {
- res.data.splice(index, 1)
- }
- })
- this.hotListData = res.data
- }
- })
- },
- click(item) {
- this.$emit('onSearch', item, 'searchText')
- },
- },
- }
- </script>
- <style module lang="scss">
- @use '@/common/design' as *;
- $color-a: #9094a2;
- $color-b: #f82b44;
- $color-c: #f96300;
- $color-d: #fac572;
- .searchrate {
- width: 210px;
- max-width: 230px;
- margin-right: 1rem;
- margin-left: 1rem;
- .num {
- display: inline-block;
- width: 20px;
- height: 20px;
- margin-right: 10px;
- line-height: 1.125;
- color: $color-a;
- text-align: center;
- border: 1px solid $color-a;
- border-radius: 10px;
- }
- :global(.ant-list) {
- :global(.ant-list-item) {
- justify-content: flex-start;
- cursor: pointer;
- &:first-child {
- .num {
- color: $color-b;
- border-color: $color-b;
- }
- }
- &:nth-child(2) {
- .num {
- color: $color-c;
- border-color: $color-c;
- }
- }
- &:nth-child(3) {
- .num {
- color: $color-d;
- border-color: $color-d;
- }
- }
- }
- }
- }
- </style>
|