Commit 89abd21c authored by frank's avatar frank 🏀

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

parent d8e5e5b4
......@@ -25,7 +25,7 @@ import {EnvHomePage} from './envCtrl/env-home/env-home.page';
const routes: Routes = [
{
path: '',
canActivateChild: [Auth],
//canActivateChild: [Auth],
children: [
{path: '', redirectTo: 'index', pathMatch: 'full'},
{path: 'home', component: HomePage},
......
......@@ -9,13 +9,13 @@
<!--(onClear)="searchText ='';toggleFocus(false);"></SearchBar>-->
<!--</div>-->
<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-toolbar>
<ion-slides style="width: 100%;height: 125px;" mode="ios"
[options]="lunbo" #slide (ionSlideTouchEnd)="slideDidChange()">
<ion-slides mode="ios" style="width: 100%;height: 125px;"
[options]="lunbo" (ionSlideTouchEnd)="slideDidChange()">
<ion-slide class="slideCon" *ngFor="let one of imgs">
<div class="inBox">
<div>
<img [src]="'../../../assets/lunbo/' + one">
</div>
</ion-slide>
......
......@@ -4,6 +4,10 @@
width: 32%;
}
.slideCon {
background-color: lavender;
}
.item {
margin-bottom: 10px;
padding: 0px 3px 0px;
......
......@@ -25,7 +25,8 @@ export class EnvHomePage implements OnInit {
},
loop: true,
spaceBetween: 0,
zoom: false
zoom: false,
height: 150,
};
farmMsg = {
......@@ -149,7 +150,7 @@ export class EnvHomePage implements OnInit {
@ViewChild('slide') slide;
ngOnInit() {
this.ionViewWillEnter();
// this.ionViewWillEnter();
}
// ionic的生命周期函数
......@@ -194,11 +195,30 @@ export class EnvHomePage implements OnInit {
}
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){
}
goTo(){
console.log('+goTo');
const query = '/index';
this.nav.navigateRoot(query);
console.log('-goTo');
}
}
......@@ -44,8 +44,7 @@ const routes: Routes = [
},
{
path: '',
redirectTo: '/tabs/tab-home',
pathMatch: 'full'
redirectTo: 'tab-home',
},
]
},
......
<ion-tabs>
<ion-tab-bar slot="bottom">
<ion-tab-button tab="tab-home">
<ion-tab-button tab="tab-home" selected="true">
<ion-label>首页</ion-label>
<ion-icon name="home"></ion-icon>
</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