上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 44 下一页
摘要: WXML提供模板(template),可以在模板中定义代码片段,然后在不同的地方调用。使用 name 属性,作为模板的名字。然后在 <template/> 内定义代码片段,使用 is 属性,声明需要的使用的模板,然后将模板所需要的 data 传入, <template is="student_tem 阅读全文
posted @ 2020-03-24 13:34 shanlu 阅读(144) 评论(0) 推荐(0) 编辑
摘要: 在组件上使用 wx:for 控制属性绑定一个数组,即可使用数组中各项的数据重复渲染该组件。默认数组的当前项的下标变量名默认为 index,数组当前项的变量名默认为 item <view wx:for="{{students}}"> {{index}}:{{item}} </view> <view w 阅读全文
posted @ 2020-03-24 13:16 shanlu 阅读(572) 评论(0) 推荐(0) 编辑
摘要: WXML 中,使用 wx:if="{{condition}}" 来判断是否需要渲染该代码块,使用 wx:elif 和 wx:else 来添加一个 else 块: <!-- data:{ length:1 } -> <view wx:if="{{length>5}}">A</view> <view w 阅读全文
posted @ 2020-03-24 12:11 shanlu 阅读(140) 评论(0) 推荐(0) 编辑
摘要: select 标签 在HTML中,<select > 创建一个下拉列表,selected 属性可以设置初始化选中 React中,并不使用这个 selected 属性,而是在根 select 标签中使用了一个 value 属性,这使得受控组件使用更方便,因为你只需要更新一处即可。 textarea标签 阅读全文
posted @ 2020-03-23 12:32 shanlu 阅读(192) 评论(0) 推荐(0) 编辑
摘要: 1,创建一个空栈,并向栈中压入1个元素 1 #include<stdio.h> 2 #include<stdlib.h> 3 4 #define CAPACITY 100 //栈的容量 5 #define SIZE 10 //如果栈需要扩充,每次扩充10 6 7 //定义栈 8 typedef st 阅读全文
posted @ 2020-03-22 22:18 shanlu 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 1,在 JavaScript 中 怎么转换列表? 我们使用 map() 函数使 numbers 数组中的元素值翻倍,将 map() 返回的新数组分配给变量 doubled 2,React中,转换数组为元素列表的方式,和上述方法基本相同 import React, { Component } from 阅读全文
posted @ 2020-03-21 23:46 shanlu 阅读(264) 评论(0) 推荐(0) 编辑
摘要: React 中的条件渲染就和在 JavaScript 中的条件语句一样。使用 JavaScript 操作符如 if 或者 条件操作符 来创建渲染当前状态的元素,并且让 React 更新匹配的 UI 。 import React, { Component } from 'react'; export 阅读全文
posted @ 2020-03-21 22:37 shanlu 阅读(424) 评论(0) 推荐(0) 编辑
摘要: 在JSX回调中 需要注意 this 的指向,在JavaScript中,类方法默认没有绑定的。如果没有绑定 this.handleClick 并将其传递给 onClick,那么在直接调用该函数时,this 会是一个 undefined。 这不是React 特有的行为,这是JavaScript 中的函数 阅读全文
posted @ 2020-03-21 19:36 shanlu 阅读(938) 评论(0) 推荐(1) 编辑
摘要: 1,创建一个双向链表,并初始化赋值 1 #include <stdio.h> 2 #include <stdlib.h> 3 4 typedef struct Link { 5 int data; 6 struct Link* prior; 7 struct Link* next; 8 }link; 阅读全文
posted @ 2020-03-18 13:03 shanlu 阅读(192) 评论(0) 推荐(0) 编辑
摘要: 1,push 2,replace push,添加一个路由历史,replace 是替代最后一个路由历史,注意区别 可分别定义 使用 push 和 使用 replace 进行路由跳转的方法,进行效果的比对, 比如,当 点击 message01 后的 push ,MessageDetails 显示 mes 阅读全文
posted @ 2020-03-17 22:44 shanlu 阅读(542) 评论(0) 推荐(0) 编辑
上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 44 下一页