/* * 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 Avatar from '@cosui/cosmic/avatar'; import Button from '@cosui/cosmic/button'; import Icon from '@cosui/cosmic/icon'; import {isURL} from '@cosui/cosmic/util'; import type {GreetingCardProps, GreetingCardData} from './interface'; export default class GreetingCard extends Component { static template = `
{{title}}
{{content}}
`; static components = { 'cos-avatar': Avatar, 'cos-button': Button, 'cos-icon': Icon }; isUrl = isURL; initData(): GreetingCardProps { return { // 头像图片url avatar: '', // 打招呼标题 title: '', // 打招呼内容 content: '', // 语音按钮数据 voice: null, // 视频按钮数据 video: null }; } /** * 处理语音按钮点击 */ handleVoiceClick(event: MouseEvent) { this.fire('voice-click', {event}); } /** * 处理视频按钮点击 */ handleVideoClick(event: MouseEvent) { this.fire('video-click', {event}); } }