/* * Copyright (c) Baidu, Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import {Component} from 'san'; import type {SearchHeaderData, SearchHeaderEvents} from './interface'; import Icon from '@cosui/cosmic/icon'; export default class SearchHeader extends Component { static template = `
总结全网{{citationCount}}篇{{subjective ? '真实经验' : '结果'}}
{{overview}}
`; static components = { 'cos-icon': Icon }; initData(): SearchHeaderData { return { // 品牌logo logo: 'https://gips0.baidu.com/it/u=2660100043,3986572706&fm=3028&app=3028&f=PNG&fmt=auto&q=100&size=f192_48', logoDark: 'https://gips3.baidu.com/it/u=2862834531,2772849958&fm=3028&app=3028&f=PNG&fmt=auto&q=100&size=f192_48', // 联名品牌logo链接 brandLogo: '', brandLogoDark: '', // 总结文案 overview: '', // 溯源数量 citationCount: 0, subjective: false, appearance: 'primary', expanded: undefined }; } handleClick(event: Event) { let expanded = this.data.get('expanded'); if (expanded !== undefined) { expanded = !expanded; this.data.set('expanded', expanded); } this.fire('citation-click', {event, expanded}); } handleOverviewClick(event: Event) { this.fire('overview-click', {event}); } }