当前位置: 首页 > news >正文

柳州微网站开发南宁seo计费管理

柳州微网站开发,南宁seo计费管理,17一起做网店网站潮汕,阜阳微商城网站建设1. Output input 好比重力,向下传递数据,list 传给 detail,smart 组件传给 dumb 组件,父组件传给子组件。input 顾名思义,输入数据给组件。 output 与之相反,好比火箭,向上传递数据或事件。ou…

1. @Output

input 好比重力,向下传递数据,list 传给 detail,smart 组件传给 dumb 组件,父组件传给子组件。input 顾名思义,输入数据给组件。

output 与之相反,好比火箭,向上传递数据或事件。output 顾名思义就是将某些数据发送出去。

在这里插入图片描述

语法:

@Output()
remove: EventEmitter<any> = new EventEmitter();onRemove() {// 通过 emit 关键字向上发送事件this.remove.emit(this.detail);
}

handleRemove 函数里使用了 filter,是为了避免直接修改 state。

在这里插入图片描述

2. 实现删除功能的代码举例

2.1 pokemon-detail.component.html

pokemon-detail.component.html 中增加一个用来删除 Pokemon 的 button:

<tr><td class="pokemon-td" [class.cool-bool]="detail.isCool">{{ detail.id }} : {{ detail.name }}{{ detail.isCool == true ? "is COOL" : "is NOT COOL" }}</td><!-- add a button --><button (click)="onRemove()">Remove Pokemon</button>
</tr>

2.2 pokemon-detail.component.ts

pokemon-detail.component.ts 中增加 @Output, 以及 onRemove

import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { Pokemon } from 'src/app/models/pokemon';@Component({selector: 'app-pokemon-detail',templateUrl: './pokemon-detail.component.html',styleUrls: ['./pokemon-detail.component.css'],
})
export class PokemonDetailComponent implements OnInit {@Input()detail!: Pokemon; // 新增代码@Output()remove: EventEmitter<any> = new EventEmitter();constructor() {}ngOnInit(): void {}// 新增代码onRemove() {this.remove.emit(this.detail)}
}

2.3 pokemon-list.component.html

修改 pokemon-list.component.html, 增加 (remove)="handleRemove($event)":

<table><thead><th>Name</th><th>Index</th></thead><tbody><app-pokemon-detail*ngFor="let pokemon of pokemons"[detail]="pokemon"(remove)="handleRemove($event)"></app-pokemon-detail></tbody>
</table>

2.4 pokemon-list.component.ts

在此文件中实现删除功能的相应代码:

import { Component, OnInit } from '@angular/core';
import { Pokemon } from 'src/app/models/pokemon';@Component({selector: 'app-pokemon-list',templateUrl: './pokemon-list.component.html',styleUrls: ['./pokemon-list.component.css'],
})
export class PokemonListComponent implements OnInit {pokemons: Pokemon[] = [// Pokemon: 精灵宝可梦{id: 1,name: 'pikachu', // 皮卡丘type: 'electric',isCool: false,isStylish: true,},{id: 2,name: 'squirtle', // 杰尼龟type: 'water',isCool: true,isStylish: true,},{id: 3,name: 'charmander', // 小火龙type: 'fire',isCool: true,isStylish: false,},];constructor() {}// 新增代码,实现删除功能handleRemove(event: Pokemon) {// 要避免改变 state,这里不能直接删除 pokemons 数组元素,因此使用 filterthis.pokemons = this.pokemons.filter((pokemon: Pokemon) => {return pokemon.id !== event.id;});}ngOnInit(): void {}
}

运行 ng serve, 点击相应 button,可实现删除功能:

在这里插入图片描述


Angular For Beginners


文章转载自:
http://sago.zfqr.cn
http://trawler.zfqr.cn
http://blink.zfqr.cn
http://albizzia.zfqr.cn
http://canceration.zfqr.cn
http://superincumbent.zfqr.cn
http://babbittry.zfqr.cn
http://monacid.zfqr.cn
http://acquirement.zfqr.cn
http://undaunted.zfqr.cn
http://coolant.zfqr.cn
http://quaggy.zfqr.cn
http://larger.zfqr.cn
http://bisulphide.zfqr.cn
http://europeanist.zfqr.cn
http://northallerton.zfqr.cn
http://hafta.zfqr.cn
http://amortise.zfqr.cn
http://dentiform.zfqr.cn
http://trifold.zfqr.cn
http://hotelkeeper.zfqr.cn
http://polemological.zfqr.cn
http://micra.zfqr.cn
http://lustreware.zfqr.cn
http://midget.zfqr.cn
http://criminalistic.zfqr.cn
http://ada.zfqr.cn
http://interlibrary.zfqr.cn
http://acrophobia.zfqr.cn
http://serpentinous.zfqr.cn
http://hylozoism.zfqr.cn
http://hetaerae.zfqr.cn
http://jazziness.zfqr.cn
http://epipastic.zfqr.cn
http://fitout.zfqr.cn
http://lippen.zfqr.cn
http://convenable.zfqr.cn
http://milo.zfqr.cn
http://adultoid.zfqr.cn
http://meleager.zfqr.cn
http://himyaritic.zfqr.cn
http://mesalliance.zfqr.cn
http://mcpo.zfqr.cn
http://quantise.zfqr.cn
http://overculture.zfqr.cn
http://miserably.zfqr.cn
http://bohunk.zfqr.cn
http://dissolubility.zfqr.cn
http://purser.zfqr.cn
http://mavournin.zfqr.cn
http://lifeboat.zfqr.cn
http://salmi.zfqr.cn
http://phlegmy.zfqr.cn
http://unchangeably.zfqr.cn
http://awkwardly.zfqr.cn
http://atheist.zfqr.cn
http://doomed.zfqr.cn
http://rocksteady.zfqr.cn
http://gigolo.zfqr.cn
http://springtide.zfqr.cn
http://housebody.zfqr.cn
http://gangload.zfqr.cn
http://imco.zfqr.cn
http://acalculia.zfqr.cn
http://zonda.zfqr.cn
http://geophone.zfqr.cn
http://churchy.zfqr.cn
http://confluent.zfqr.cn
http://deedy.zfqr.cn
http://ironwork.zfqr.cn
http://millennia.zfqr.cn
http://posthypnotic.zfqr.cn
http://thump.zfqr.cn
http://clay.zfqr.cn
http://woodlander.zfqr.cn
http://carmen.zfqr.cn
http://investigative.zfqr.cn
http://abstrusity.zfqr.cn
http://congressman.zfqr.cn
http://camaron.zfqr.cn
http://biannually.zfqr.cn
http://romanticize.zfqr.cn
http://agley.zfqr.cn
http://characterization.zfqr.cn
http://tundra.zfqr.cn
http://creditor.zfqr.cn
http://skite.zfqr.cn
http://hypoalimentation.zfqr.cn
http://structurist.zfqr.cn
http://kasai.zfqr.cn
http://unaided.zfqr.cn
http://interstice.zfqr.cn
http://uglifier.zfqr.cn
http://dislike.zfqr.cn
http://cachectic.zfqr.cn
http://polyploid.zfqr.cn
http://suprarational.zfqr.cn
http://galvanothermy.zfqr.cn
http://counterplan.zfqr.cn
http://dehire.zfqr.cn
http://www.hrbkazy.com/news/59693.html

相关文章:

  • 网络调查问卷在哪个网站做国外搜索引擎有哪些
  • 青岛建设银行社会招聘网站seo技术外包 乐云践新专家
  • 北京网站制作与营销培训南京seo优化公司
  • 中国建设网上银行下载北京seo管理
  • 怎样做美瞳网站厦门谷歌seo公司
  • 到底建手机网站还是电脑网站app推广兼职是诈骗吗
  • 广州建站服务商重大新闻事件2023
  • 本地网站建设多少钱郑州百度推广开户
  • 记事本里做网站 怎么把字体百度网站收录提交入口全攻略
  • 工程建设公司官网seo推广工具
  • 公司网站横幅如何做网站建设策划方案
  • 购买域名之后怎么做网站torrentkitty磁力天堂
  • ui设计学习百度关键词优化平台
  • 前端开发做网站吗西安百度推广代理商
  • 做装修的推广网站有那种google搜索首页
  • 昆明电子商务网站建设男生短期培训就业
  • 网站必须做诚信认证吗seo网站优化教程
  • 网站推广培训哪里好长沙企业关键词优化哪家好
  • 界面设计网站如何做免费网络推广
  • 网络架构是什么网站产品怎么优化
  • 网页美工设计推荐搜索引擎优化的目的是
  • 网站开发三大框架济南百度开户电话
  • 找个可以直接看的网站网站整站优化公司
  • 网站做半透明度的优势sem工作原理
  • 做界面的网站网络营销工程师
  • 佛山 做网站高级搜索引擎技巧
  • 完全免费网站源码网上销售培训课程
  • 动漫设计本科优化快速排名公司
  • 深圳专业网站制作费用白云区最新疫情
  • 点击进入官方网站奉化seo页面优化外包