import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-feedback', templateUrl: './feedback.page.html', styleUrls: ['./feedback.page.scss'], }) export class FeedbackPage implements OnInit { chatMessages: { text: string, sender: string, avatar: string }[] = []; newMessage: string = ''; constructor() {} ngOnInit() { // 模拟一些聊天消息 this.chatMessages = [ { text: '你好,请问有什么可以帮助您的吗?', sender: 'customer', avatar: 'customer-avatar.jpg' }, { text: '您好,我想咨询一下关于产品的信息。', sender: 'support', avatar: 'support-avatar.png' } ]; } sendMessage() { if (this.newMessage.trim() !== '') { this.chatMessages.push({ text: this.newMessage, sender: 'customer', avatar: 'customer-avatar.jpg' }); // 在这里可以添加客服回复的逻辑 this.newMessage = ''; } } }