Commit 89abd21c authored by frank's avatar frank 🏀

修复了环控首页路由卡死的bug

parent d8e5e5b4
...@@ -25,7 +25,7 @@ import {EnvHomePage} from './envCtrl/env-home/env-home.page'; ...@@ -25,7 +25,7 @@ import {EnvHomePage} from './envCtrl/env-home/env-home.page';
const routes: Routes = [ const routes: Routes = [
{ {
path: '', path: '',
canActivateChild: [Auth], //canActivateChild: [Auth],
children: [ children: [
{path: '', redirectTo: 'index', pathMatch: 'full'}, {path: '', redirectTo: 'index', pathMatch: 'full'},
{path: 'home', component: HomePage}, {path: 'home', component: HomePage},
......
...@@ -9,13 +9,13 @@ ...@@ -9,13 +9,13 @@
<!--(onClear)="searchText ='';toggleFocus(false);"></SearchBar>--> <!--(onClear)="searchText ='';toggleFocus(false);"></SearchBar>-->
<!--</div>--> <!--</div>-->
<ion-toolbar> <ion-toolbar>
<ion-button [routerLink]="['/index']" slot="start" size ="small" color="light">Home</ion-button> <ion-button slot="start" size ="small" color="light" (click)="goTo()">Home</ion-button>
<ion-searchbar></ion-searchbar> <ion-searchbar></ion-searchbar>
</ion-toolbar> </ion-toolbar>
<ion-slides style="width: 100%;height: 125px;" mode="ios" <ion-slides mode="ios" style="width: 100%;height: 125px;"
[options]="lunbo" #slide (ionSlideTouchEnd)="slideDidChange()"> [options]="lunbo" (ionSlideTouchEnd)="slideDidChange()">
<ion-slide class="slideCon" *ngFor="let one of imgs"> <ion-slide class="slideCon" *ngFor="let one of imgs">
<div class="inBox"> <div>
<img [src]="'../../../assets/lunbo/' + one"> <img [src]="'../../../assets/lunbo/' + one">
</div> </div>
</ion-slide> </ion-slide>
......
...@@ -4,6 +4,10 @@ ...@@ -4,6 +4,10 @@
width: 32%; width: 32%;
} }
.slideCon {
background-color: lavender;
}
.item { .item {
margin-bottom: 10px; margin-bottom: 10px;
padding: 0px 3px 0px; padding: 0px 3px 0px;
......
...@@ -25,7 +25,8 @@ export class EnvHomePage implements OnInit { ...@@ -25,7 +25,8 @@ export class EnvHomePage implements OnInit {
}, },
loop: true, loop: true,
spaceBetween: 0, spaceBetween: 0,
zoom: false zoom: false,
height: 150,
}; };
farmMsg = { farmMsg = {
...@@ -149,7 +150,7 @@ export class EnvHomePage implements OnInit { ...@@ -149,7 +150,7 @@ export class EnvHomePage implements OnInit {
@ViewChild('slide') slide; @ViewChild('slide') slide;
ngOnInit() { ngOnInit() {
this.ionViewWillEnter(); // this.ionViewWillEnter();
} }
// ionic的生命周期函数 // ionic的生命周期函数
...@@ -194,11 +195,30 @@ export class EnvHomePage implements OnInit { ...@@ -194,11 +195,30 @@ export class EnvHomePage implements OnInit {
} }
slideDidChange() { slideDidChange() {
//this.slide.startAutoplay(); // this.slide.startAutoplay();
this.lunbo = {
speed: 1000,
allowTouchMove: true,
effect: 'flip',
autoplay: {
delay: 2000,
},
loop: true,
spaceBetween: 0,
zoom: false,
height: 150,
};
} }
toggleFocus(a){ toggleFocus(a){
} }
goTo(){
console.log('+goTo');
const query = '/index';
this.nav.navigateRoot(query);
console.log('-goTo');
}
} }
...@@ -44,8 +44,7 @@ const routes: Routes = [ ...@@ -44,8 +44,7 @@ const routes: Routes = [
}, },
{ {
path: '', path: '',
redirectTo: '/tabs/tab-home', redirectTo: 'tab-home',
pathMatch: 'full'
}, },
] ]
}, },
......
<ion-tabs> <ion-tabs>
<ion-tab-bar slot="bottom"> <ion-tab-bar slot="bottom">
<ion-tab-button tab="tab-home"> <ion-tab-button tab="tab-home" selected="true">
<ion-label>首页</ion-label> <ion-label>首页</ion-label>
<ion-icon name="home"></ion-icon> <ion-icon name="home"></ion-icon>
</ion-tab-button> </ion-tab-button>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment