瀏覽代碼

feat:one test

202226701056 4 月之前
父節點
當前提交
0c164aa8d2

+ 4 - 1
angular.json

@@ -126,7 +126,10 @@
     }
   },
   "cli": {
-    "schematicCollections": ["@ionic/angular-toolkit"]
+    "schematicCollections": [
+      "@ionic/angular-toolkit"
+    ],
+    "analytics": "2bf4e732-eac0-4895-969b-61982f88d1bc"
   },
   "schematics": {
     "@ionic/angular-toolkit:component": {

+ 3 - 0
src/app/edit-tag/README.md

@@ -0,0 +1,3 @@
+#标签编辑组件
+上面:输入框和确定按钮
+下面:字符串数组

+ 2 - 0
src/app/edit-tag/edit-tag.component.html

@@ -0,0 +1,2 @@
+<ion-input (ionInput)="UserInput($event)" type="text" placeholder="请输入标签"></ion-input>
+<p>当前输入:{{userInputText}}</p><ion-input (click)="addTag()">添加标签</ion-input>

+ 0 - 0
src/app/edit-tag/edit-tag.component.scss


+ 22 - 0
src/app/edit-tag/edit-tag.component.spec.ts

@@ -0,0 +1,22 @@
+import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
+
+import { EditTagComponent } from './edit-tag.component';
+
+describe('EditTagComponent', () => {
+  let component: EditTagComponent;
+  let fixture: ComponentFixture<EditTagComponent>;
+
+  beforeEach(waitForAsync(() => {
+    TestBed.configureTestingModule({
+      imports: [EditTagComponent],
+    }).compileComponents();
+
+    fixture = TestBed.createComponent(EditTagComponent);
+    component = fixture.componentInstance;
+    fixture.detectChanges();
+  }));
+
+  it('should create', () => {
+    expect(component).toBeTruthy();
+  });
+});

+ 34 - 0
src/app/edit-tag/edit-tag.component.ts

@@ -0,0 +1,34 @@
+import { Component, OnInit } from '@angular/core';
+import { IonInput } from "@ionic/angular/standalone";
+
+@Component({
+  selector: 'app-edit-tag',
+  templateUrl: './edit-tag.component.html',
+  styleUrls: ['./edit-tag.component.scss'],
+  imports:[
+    IonInput
+  ],
+  standalone: true,
+})
+export class EditTagComponent  implements OnInit {
+  /**
+   * 用户输入
+   */
+  userInputText:string=""
+    UserInput(ev:any){
+      console.log(ev)
+      this.userInputText=ev.detail.value
+    }
+    /**
+     * 标签列表
+     */
+    tags:Array<string>=[]
+    addTag(){
+      this.tags.push(this.userInputText)
+      this.userInputText=""
+    }
+  constructor() { }
+
+  ngOnInit() {}
+
+}

+ 8 - 1
src/app/tab1/tab1.page.html

@@ -7,11 +7,18 @@
 </ion-header>
 
 <ion-content [fullscreen]="true">
+
   <ion-header collapse="condense">
     <ion-toolbar>
       <ion-title size="large">Tab 1</ion-title>
     </ion-toolbar>
   </ion-header>
-
+<ion-button expand="block" size="large" color="tertiary"  (mouseup)="toRecordLearn">
+<ion-icon slot="start" > </ion-icon>
+我的学习记录
+</ion-button>
   <app-explore-container name="Tab 1 page"></app-explore-container>
+  <div>
+    <app-edit-tag>1</app-edit-tag>
+  </div>
 </ion-content>

+ 5 - 1
src/app/tab1/tab1.page.ts

@@ -1,14 +1,18 @@
 import { Component } from '@angular/core';
 import { IonHeader, IonToolbar, IonTitle, IonContent, IonImg, IonCard, IonCardHeader, IonCardTitle, IonCardContent, IonButton, IonApp, IonText, IonLabel, IonItem, IonList, IonSegment, IonSegmentButton, IonTabButton, IonIcon, IonFooter, IonTabs, IonCol, IonGrid, IonRow } from '@ionic/angular/standalone';
 import { ExploreContainerComponent } from '../explore-container/explore-container.component';
+import {EditTagComponent} from  '../edit-tag/edit-tag.component'
 
 @Component({
   selector: 'app-tab1',
   templateUrl: 'tab1.page.html',
   styleUrls: ['tab1.page.scss'],
   standalone: true,
-  imports: [IonRow, IonGrid, IonCol, IonTabs, IonFooter, IonIcon, IonTabButton, IonSegmentButton, IonSegment, IonList, IonItem, IonLabel, IonText, IonApp, IonButton, IonCardContent, IonCardTitle, IonCardHeader, IonCard, IonImg, IonHeader, IonToolbar, IonTitle, IonContent, ExploreContainerComponent],
+  imports: [IonIcon, IonTabButton, IonSegmentButton, IonSegment, IonList, IonItem, IonLabel, IonText, IonApp, IonButton, IonCardContent, IonCardTitle, IonCardHeader, IonCard, IonImg, IonHeader, IonToolbar, IonTitle, IonContent, ExploreContainerComponent,EditTagComponent],
 })
 export class Tab1Page {
+  toRecordLearn(){
+    alert("记录学习情况,双击666")
+  }
   constructor() {}
 }