This commit is contained in:
2021-11-21 22:59:12 +08:00
parent e73580a025
commit e9cc138af8
5 changed files with 20 additions and 2 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
import React from 'react'
import Swiper from './components/index'
import Swiper from './components/hoc'
import './components/app.css'
class App extends React.Component{
constructor(){
+7 -1
View File
@@ -1,3 +1,9 @@
/*
* @Author: chenxuan
* @Date: 2021-11-21 15:55:15
* @LastEditTime: 2021-11-21 22:55:37
* @LastEditors: chenxuan
*/
import React from 'react';
function Hoc(WithComponent){
return class HocComponent extends React.Component{
@@ -54,7 +60,7 @@ function Hoc(WithComponent){
this.Data=this.props.data;
if(this.Data && this.Data.length>0 && this.isInit){
for(let i=0;i<this.Data.length;i++){
if(i==1){
if(i===1){
this.Data[i].active=true;
}
else {
+6
View File
@@ -1,3 +1,9 @@
/*
* @Author: chenxuan
* @Date: 2021-11-21 15:55:15
* @LastEditTime: 2021-11-21 22:54:16
* @LastEditors: chenxuan
*/
import React from 'react'
import Hoc from './hoc';
import './style.css'
@@ -1,3 +1,9 @@
/*
* @Author: chenxuan
* @Date: 2021-11-21 15:55:15
* @LastEditTime: 2021-11-21 22:57:24
* @LastEditors: chenxuan
*/
import React from 'react'
import './style.css'
export default class Swiper extends React.Component{