Use angular, react and vue to implement the same interview question component

小云云
Release: 2018-02-22 10:20:05
Original
1549 people have browsed it

React, angular, and vue are all three frameworks that have become popular recently. This article mainly introduces to you the relevant content about angular, react, and vue implementing the same interview question components. I will share them for your reference and study. I will not say anything else below. Enough said, let’s take a look at the detailed introduction.

Interview question requirements are as follows

##1. Angular:

    Document   
  • {{item.text}}
Copy after login
2. React:

import React, { Component } from 'react'; import './App.css'; class App extends Component { constructor(){ super(); this.state={ alll:[], values:'', flag:true } } add(e){ let arr1 = this.state.alll; arr1.push({msg:this.state.values,check1:false}); this.setState({ alll:arr1 }) console.log(this.state.alll); } change(e){ this.setState({ values:e.nativeEvent.target.value }) } delate(e){ let index1 = e.target.parentNode.id; let arr1 = []; for(var i =0;i{ alert(1); console.log(this.state.alll) } ) } checktoggle(e){ let index1 = e.target.parentNode.id; let arr1 = this.state.alll; arr1[index1].check1 = !arr1[index1].check1; this.setState({ alll:arr1 }) console.log(this.state.alll); } hideandshow(e){ this.setState({ flag : !this.state.flag }) } removeAll(){ let arr1 = []; for(var i =0;i-1;i--){ console.log(i); if(arr1[i].check1 === true){ arr1.splice(i,1); } } this.setState({ alll:arr1 }) console.log(this.state.alll); } render() { var result = []; for(let i = 0;i{this.state.alll[i].msg}

) } return (

{this.state.values}

    {result}

); } } export default App; //使用react写时,数组的复制有使用的不标准,正确的深度复制应该转化为字符串以后再复制,类似于代码中removeAll复制的方式。但是在当前实例中浅复制也可以完成功能。
Copy after login
3 , vue2.0:

    Document   

{{item.msg1}}

Copy after login


The above is the detailed content of Use angular, react and vue to implement the same interview question component. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!