随堂小练小功能小结

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/xsh096011/article/details/89408353

数据显示:

const url = 'url地址';
this.http.get(url).subscribe(
      res => {
        if (res.json().code === '0000') {
				this.lesson = res.json().data;  //赋值给lesson;通过数据绑定显示在HTML页面
			 }
      }
    );

数据绑定:双向绑定

{{item.questionContent}}
[]单向绑定

*ngFor循环数组

*ngFor='let item of lesson'

事件
(click)="SavaExamId()"点击事件
(updateAnswer)=“changeAnswerSheet($event)”

路由跳转:(两种方式)

this.router.navigate(['tabs/home/student-main/exam-mode/question'], {
     // queryParams: {
     //   courseId: 1071025936788471810,
     //   questionTypeId: 1072112901400514563
     // }
   });

this.router.navigateByUrl('question1');

轮播图实现卡片切换:

 <ion-card class="cardexam" lines="none">
    <ion-slides style=" height: 80%; width: 90% ">
        	<ion-slide *ngFor='let item of exampaper,let i=index'>
     </ion-slide>
       </ion-slides>
    </ion-card>

内容居左:(通过style样式调整)(合理运用空格&nbsp;和换行</br>也会非常方便界面调整)

<div style="float:left">
</div>

内循环显示数据ABCD;
{{alphabet[j]+’. '}}

通过id和name唯一标识单选按钮;

<input type="radio" name="{{item.questionId}}" id="{{item.questionId}}">

获得div元素属性:

<div id="sidebar_left">
const oDiv = document.getElementById('sidebar_left');
通过元素hidden属性来控制div显示和隐藏;

界面拼接:合理运用div实现;
基础运用好了,就会非常厉害了。
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/xsh096011/article/details/89408353