param

React-Native传值方式之 :DeviceEventEmitter添加监听控制并传值到其他页面

主宰稳场 提交于 2019-11-30 07:10:20
在 native 开发中,我们可以使用广播实现事件的订阅和事件的触发,从而实现不在该页面但是可以调用该页面的方法。 在 React Native 中,我们也可以使用 DeviceEventEmitter 实现类似的功能 该方法是官方 API,调用时,直接引用就行了。 1 import {DeviceEventEmitter} from 'react-native'; 2 //… 3 //调用事件通知 4 DeviceEventEmitter.emit('xxxName’,param); 5 //xxxName:通知的名称 param:发送的消息(传参) 如果我们要实现 在A页面:点击按钮传递参数到B页面 在B页面:使用接收的参数刷新列表 操作如下 在B页面实现事件的监听,假设我们将事件命名为 refreshListListener componentDidMount(){ var self = this; this.listener =DeviceEventEmitter.addListener('xxxName',function(param){ // use param do something }); } //xxxName:通知的名称 param:接收到的消息(传参) componentWillUnmount(){ this.listener.remove(); } /

What does @param mean in a class?

感情迁移 提交于 2019-11-30 06:22:52
What does the @param mean when creating a class? As far as I understand it is used to tell the script what kind of datatype the variables are and what kind of value a function returns, is that right? For example: /** * @param string $some * @param array $some2 * @return void */ Isn´t there another way to do that, I am thinking of things like: void function() { ... } or something like that. And for variables maybe (int)$test; @param doesn't have special meaning in PHP, it's typically used within a comment to write up documentation. The example you've provided shows just that. If you use a

前端常用js方法工具封装

假如想象 提交于 2019-11-30 06:11:16
不定期更新 let util = {}; /** * 获取指定数组指定key对应的值比较,若相等则返回该value值 * @param arr Array 需要遍历的数组 * @param id string 需要对比值的 * @param find String 等待对比的值,默认对比id * @param result String 等待对比成功后返回的值,默认value */ util.getResult = function (arr = [], id = '', find = 'id', result = 'value') { let value = ''; if (id === undefined || id === null || !find || !result) {return '';} arr.map(function (e) { if (e[find] === id) {value = e[result]; } }); return value; }; /** * 字符串 去 前后空格 * @param {*} str 字符串 */ util.trim = function (str = '') { if (!str || str === undefined || str === null || typeof str !== 'string') {

pytest_参数化之3*3

怎甘沉沦 提交于 2019-11-30 06:07:54
import pytesttest_user_data1=[{'user':'linda','password':'888888'}, {'user':'servenruby','password':'123456'}, {'user':'test01','password':''}]test_user_data2=[{'q':'中国平安','count':3,'page':1}, {'q':'阿里巴巴','count':2,'page':2}, {'q':'pdd','count':3,'page':1}]@pytest.fixture(scope='module')def login_r(request): #这是接受不了输入的参数,接收一个参数 user=request.param['user'] pwd=request.param['password'] print('\n用户名:%s,密码:%s'%(user,pwd))@pytest.fixture(scope='module')def query_param(request): q=request.param['q'] count=request.param['count'] page=request.param['page'] print('查询的搜索词%s'%q) return request.param

js调用轮询接口

北城以北 提交于 2019-11-30 04:22:52
项目中遇到需要很多个需要轮询处理的接口,然后简单的封装了下,做个记录,以后用到类似的直接copy // polling-utils.js /** * @descripting 轮询功能 * @param {String} type 请求类型 * @param {String} url 地址 * @param {Object} data 请求数据 * @param {Number} delay 轮询间隔时间 */ export default function polling(type, url, data, delay = 1000) { return new Promise((resolve, reject) =>{ ajax[type](url, data).then(res => { if (res.data === 'polling') { setTimeout(() => { resolve(polling(type, url, data)); }, delay) } else { resolve(res); } }) }) } 用法 import polling from 'utils/polling-utils'; polling('post', url, data).then(res => { console.log(res) }) 来源: https://www

最简单的获取相机拍照的图片

拥有回忆 提交于 2019-11-30 03:38:12
import android.content.Intent; import android.graphics.Bitmap; import android.os.Bundle; import android.os.Environment; import android.provider.MediaStore; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import com.ol.xow.R; public class TakePhotoActivity extends AppCompatActivity { public static final int REQUEST_TAKEPHOTOS_CODE = 0003; private TextView tvPhotos; private ImageView imgView; @Override protected void onCreate(@Nullable Bundle savedInstanceState) {

log4net快速上手

人走茶凉 提交于 2019-11-30 03:33:06
原文: log4net快速上手 原文地址:https://www.cnblogs.com/lsgsanxiao/p/5845300.html 略有删改 1.配置文件,可以单独创建log4net.config文件,然后手动指定目录,也可以在项目的app.config或web.config的configuration节点下插入以下代码 <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" /> </configSections> <log4net> <logger name="logerror"> <level value="ERROR" /> <appender-ref ref="ErrorAppender" /> </logger> <logger name="loginfo"> <level value="INFO" /> <appender-ref ref="InfoAppender" /> </logger> <appender name="ErrorAppender" type="log4net

织梦官方幻灯片调用以及幻灯片模糊的处理办法

◇◆丶佛笑我妖孽 提交于 2019-11-30 02:16:42
复制官方默认的模板里面的代码如下到幻灯片位置,后台新建栏目-首页幻灯,设置大小,typeid,f为勾选幻灯。 <div class="flashnews"><!-- size: 280px * 192px --> <script language='javascript'> linkarr = new Array(); picarr = new Array(); textarr = new Array(); var swf_width=280; var swf_height=192; //文字颜色|文字位置|文字背景颜色|文字背景透明度|按键文字颜色|按键默认颜色|按键当前颜色|自动播放时间|图片过渡效果|是否显示按钮|打开方式 var configtg='0xffffff|0|0x3FA61F|5|0xffffff|0xC5DDBC|0x000033|2|3|1|_blank'; var files = ""; var links = ""; var texts = ""; //这里设置调用标记 {dede:arclist flag='f' row='5' typeid='3'} linkarr[[field:global.autoindex/]] = "[field:arcurl/]"; picarr[[field:global.autoindex/]] = "[field

BigDecimalUtils BigDecimal加减乘除

拥有回忆 提交于 2019-11-30 00:34:32
public class BigDecimalUtil { private static int DEF_DIV_SCALE = 10 ; // 默认精确的小数位 /** * 提供精确的加法运算。 * * @param v1 被加数 * @param v2 加数 * @return 两个参数的和 */ public static double add ( double v1 , double v2 ) { BigDecimal b1 = new BigDecimal ( Double . toString ( v1 ) ) ; BigDecimal b2 = new BigDecimal ( Double . toString ( v2 ) ) ; return b1 . add ( b2 ) . doubleValue ( ) ; } /** * 提供精确的减法运算。 * * @param v1 被减数 * @param v2 减数 * @return 两个参数的差 */ public static double sub ( double v1 , double v2 ) { BigDecimal b1 = new BigDecimal ( Double . toString ( v1 ) ) ; BigDecimal b2 = new BigDecimal ( Double .

小程序登录和解密

独自空忆成欢 提交于 2019-11-29 21:52:01
微信官方参考文档:https://developers.weixin.qq.com/miniprogram/dev/api/open-api/login/wx.login.html 微信登录 /** * * @param code 微信启示拿到的code * @param wxName 微信昵称 * @param photo 微信头像 */ @RequestMapping(method = RequestMethod.POST, value = "login") @UserEvent(desc = "微信首次登录接口") public ResultBean login(String code, String wxName, String photo) { ResultBean result = new ResultBean(); // 小程序appID String appid = WechatConstants.APPID; // 小程序密钥 String appsecret = WechatConstants.APPSECRET; // 授权(必填) String grant_type = "authorization_code"; // URL String url = "https://api.weixin.qq.com/sns/jscode2session"; //