12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- import { Component } from '@angular/core';
- import { Router } from '@angular/router';
- @Component({
- selector: 'app-tab1',
- templateUrl: 'tab1.page.html',
- styleUrls: ['tab1.page.scss']
- })
- export class Tab1Page {
- searchQuery: string='';
- searchResults: string[] = ['探索星球', '探索轨迹', '探索资源', '探索敌人信息'];
- filteredResults: string[] = [];
- showResults: boolean = false;
- constructor(private router: Router) {}
- goTocommunity()
- {
- this.router.navigate(['/community'])
- }
- goToNewPage()
- {
- this.router.navigate(['/login']);
- }
- search() {
- this.filteredResults = this.searchResults.filter(result =>
- result.toLowerCase().includes(this.searchQuery.toLowerCase())
- );
-
- if (this.searchQuery && this.searchQuery.trim() !== '' && this.filteredResults.length > 0) {
- this.showResults = true;
- } else {
- this.showResults = false;
- }
- }
-
- reports: Report[] = [
- { id: 1, title: '报告标题1', content: '这是报告内容1' },
- { id: 2, title: '报告标题2', content: '这是报告内容2' },
- { id: 3, title: '报告标题3', content: '这是报告内容3' },
- ];
-
- }
- export interface Report {
- id: number;
- title: string;
- content: string;
- }
|