此处将为大家介绍关于警告:isMounted的详细内容,并且为您解答有关…在纯Javascript类中已弃用的相关问题,此外,我们还将为您介绍关于ArcGISAPIforJavaScript4相当于J
此处将为大家介绍关于警告:isMounted的详细内容,并且为您解答有关…在纯Javascript类中已弃用的相关问题,此外,我们还将为您介绍关于ArcGIS API for JavaScript 4 相当于 JavaScript 3 next and previous extent?、Auntion-TableSort javascript类文件_javascript技巧、DOM在纯JavaScript中实现?、javascript onmouseout 解决办法_javascript技巧的有用信息。
本文目录一览:- 警告:isMounted(…)在纯Javascript类中已弃用(请问在javascript程序中)
- ArcGIS API for JavaScript 4 相当于 JavaScript 3 next and previous extent?
- Auntion-TableSort javascript类文件_javascript技巧
- DOM在纯JavaScript中实现?
- javascript onmouseout 解决办法_javascript技巧
警告:isMounted(…)在纯Javascript类中已弃用(请问在javascript程序中)
我正在使用react-navigation实现2个屏幕。但是导航到第二页时出现以下警告:
警告:isMounted(…)在纯Javascript类中已弃用。相反,请确保在componentWillUnmount中清除订阅和未决请求,以防止内存泄漏。
版本:
- 反应:16.3.1
- 反应本机:0.55.2
- 反应导航:1.5.11
- 效用:0.10.3
Login.js
import React, { Component } from ''react'';import { Text, View, Image, TextInput, TouchableOpacity } from ''react-native'';import styles from "./styles";export default class Login extends Component { constructor(props) { super(props);}render() { const { navigate } = this.props.navigation; return ( <View style={styles.container}> <View style={styles.formContainer}> <TouchableOpacity style={styles.button} onPress={()=> navigate(''Home'')} > <Text style={styles.buttonText}>LOGIN</Text> </TouchableOpacity> </View> </View> )}
Home.js
import React, { Component } from ''react'';import { Text, View } from ''react-native'';import styles from "./styles";export default class Home extends Component { constructor(props) { super(props); } render() { const { navigate } = this.props.navigation; return( <View style={styles.container}> <Text>Home Screen</Text> </View> ) }}
我在这里想念什么?
答案1
小编典典这是最新的React Navigation和React Native的问题。要使其静音,请添加:
import { YellowBox } from ''react-native'';YellowBox.ignoreWarnings([''Warning: isMounted(...) is deprecated'', ''Module RCTImageLoader'']);
我预计它将在接下来的几周内在React Navigation中修复。
ArcGIS API for JavaScript 4 相当于 JavaScript 3 next and previous extent?
如何解决ArcGIS API for JavaScript 4 相当于 JavaScript 3 next and previous extent??
我试图找到与 JavaScript 3 文档中讨论的下一个范围和上一个范围方法等效的 JavaScript 4。此链接会将您带到我在 3 的文档中所指的页面。在 4 的文档中没有类似于 esri/toolbars/navigation 的路径,我似乎在其他任何地方都找不到。
https://developers.arcgis.com/javascript/3/jsapi/navigation-amd.html
非常感谢!
解决方法
4x 中的 3x 导航工具栏没有现成的等效项,也没有其特定的 zoomToNextExtent/zoomToPrevExtent 方法。见https://developers.arcgis.com/javascript/latest/functionality-matrix/#esritoolbars
要复制这些方法,您必须观察范围的变化并自己跟踪它们:
let extentArray = [];
// Get the new extent of the view only when view is stationary.
watchUtils.whenTrue(view,"stationary",function() {
if (view.extent) {
extentArray.push(view.extent.clone());
}
});
Auntion-TableSort javascript类文件_javascript技巧
tablesort.class.js
复制代码 代码如下:
/* * 表格名不能为空,可为已获取的对象或名字 * 表头名默认为:tag * 通过自行编写接口可实现不同的触发排序方式 * * 作者:Auntion * E-mail:Auntion@Gmail.com * OICQ:82874972 * * 日期:2007年04月22日 - 测试 - 待修正 */ var tableSort= function(element,tagName,upStyle,downStyle){this.table= (typeof(element) == 'string') ? TAGDom.fromId(element) : element;this.td = this.table.getElementsByTagName("td"); this.hName= (tagName.length<1) ? "tag" : tagName;this.rows = this.table.rows;this.byUp = (upStyle == undefined) ? "DescUp" : upStyle ;this.byDown = (downStyle == undefined) ? "DescDown" : downStyle ;var totalTd = [];var totalNr = [];var totalTag= [];this.tempCellIndex; this.tempStatus = {};var setAllTag = function(){ for(var i = 0; i < this.td.length; i++){if(this.td[i].className === this.hName) totalTag.push(this.td[i]);}}.bind(this);var getStatus = function(tagName){this.tempStatus[tagName] = (this.tempStatus[tagName] == true) ? false : true;for(tags in this.tempStatus){if(tags == tagName) return this.tempStatus[tags];else delete this.tempStatus[tags];}}.bind(this);var changeShow = function(cellIn,status){for(var i=0; i<totalTag.length; i++){if(totalTag[i].cellIndex == cellIn){if(status == true) totalTag[i].className = this.byUp;else if(status == false) totalTag[i].className = this.byDown;}else{totalTag[i].className = this.hName;}}}.bind(this);var startSort = function(status){for (var i = totalNr[this.tempCellIndex].length - 1; i > 0; i--){for (var j = 0; j < i; ++j){if ( (status == true) ? totalNr[this.tempCellIndex][j] > totalNr[this.tempCellIndex][j + 1] : totalNr[this.tempCellIndex][j] < totalNr[this.tempCellIndex][j + 1] ){var temp = totalNr[this.tempCellIndex][j + 1];totalNr[this.tempCellIndex][j + 1] = totalNr[this.tempCellIndex][j];totalNr[this.tempCellIndex][j] = temp;for(var n=0; n<totalNr.length; n++){if(n != this.tempCellIndex){var temps = totalNr[n][j+1];totalNr[n][j + 1] = totalNr[n][j];totalNr[n][j] = temps;}}}}};InsertContect();}.bind(this);var InsertContect = function(){ for(var i=0; i<totalTd.length; i++){for(var j=0; j<totalTd[i].length; j++){totalTd[i][j].innerHTML = totalNr[i][j];}};totalTd.length = 0;totalNr.length = 0;};this.init = function(status){for(var i=0; i<(this.td.length/this.rows.length); i++){totalTd[i] = new Array();totalNr[i] = new Array();for(var j=0; j<this.rows.length; j++){if(this.rows[j].cells[i].className !== this.hName){totalTd[i][j-1] = this.rows[j].cells[i];if(IsNumber(this.rows[j].cells[i].innerHTML) == true){totalNr[i][j-1] = parseInt(this.rows[j].cells[i].innerHTML);}else{totalNr[i][j-1] = this.rows[j].cells[i].innerHTML;}}}}startSort(status);} /********************************************************************************************************************************/ /**通过点击标签触发排序事件**/ //public: 通过默认鼠标事键触发 (interface example)(设置用户接口的范例) this.toTagStart = function(){ setAllTag(); //获取标签 for(var i=0; i<totalTag.length; i++){ totalTag[i].sIndex = function(cIndex){ this.tempCellIndex=cIndex }.bind(this); //设置列index totalTag[i].gStatus = function(values){ return getStatus(values) }; //获取与设置状态 totalTag[i].ceShow = function(i,s){ changeShow(i,s) }; //改变显示的东西 totalTag[i].stSort = function(status){ this.init(status) }.bind(this); //初始化 totalTag[i].onselectstart = function(){ return false }; //点击不选中文字 totalTag[i].onclick = function(){ this.sIndex(this.cellIndex); this.status = this.gStatus(this.firstChild.nodeValue); this.ceShow(this.cellIndex,this.status); this.stSort(this.status); } } } }
Language.ext.js
复制代码 代码如下:
/* * By Auntion QQ:82874972 Blog:Auntion@blogbus.com Email:Auntion@Gmail.com 请勿删除此部分注释.谢谢! ver date-2007-02-01 * */ var isIe = /msie/i.test(navigator.userAgent); var TAGDom = { fromId: function(i){ return document.getElementById(i); }, fromName: function(i){ return document.getElementById(i); }, fromClass: function(className,baseId) { this.fatherId = null; if(!baseId){ this.fatherId = document; }else{ this.fatherId = DOM.fromId(baseId); } var basic = fatherId.getElementsByTagName("*") || document.all; var child = null; var classNames = null; var aggregate = []; for (var i = 0; i < basic.length; i++) { child = basic[i]; classNames = child.className.split(" "); for (var j = 0; j < classNames.length; j++) { if (classNames[j] == className) { aggregate.push(child); break; } } } return aggregate; } }; function externalStyle (element, target) { this.setReturn; if (element.currentStyle){ this.setReturn = element.currentStyle[target]; }else if (window.getComputedStyle){ this.setReturn = getComputedStyle (element,"").getPropertyValue(target); } return this.setReturn; } String.prototype.toInt = function(){ return parseInt(this.replace(/[a-zA-Z]+/,'')); } String.prototype.trim = function(){ return this.replace(/(^\s*)|(\s*$)/g, ""); } Function.prototype.bind = function(e) { var source = this; return function() { return source.apply(e,arguments); } } function IsNumber(_str){ var tmp_str = _str.trim(); var pattern = /^(- ¦\+)?\d+(\d+)?$/; return pattern.test(tmp_str); }
使用实例_1.htm
复制代码 代码如下:
<html> <head> <title>Auntion - TableSort 测试交流</title> <style type="text/css"> #bodys{ border-top:1px solid #0099FF; border-left:1px solid #0099FF; } #bodys td { border-bottom:1px solid #0099FF; border-right:1px solid #0099FF; font-size:12px; height:22px; line-height:22px; text-align:left; padding-left:10px; background:#DFEFFF; color:#666666; } #bodys td.tag { background:#95D5FF; color:#333333; font-weight:900; height:28px; line-height:28px; cursor:pointer; } #bodys td.DescUp { background:#FFFFCC url("byUp.gif") no-repeat right 6px; color:#333333; font-weight:900; height:28px; line-height:28px; cursor:pointer; } #bodys td.DescDown { background:#FFFFCC url("byDown.gif") no-repeat right 6px; color:#333333; font-weight:900; height:28px; line-height:28px; cursor:pointer; } </style> <script language="javascript" type="text/javascript" src="Language.ext.js"></script> <script language="javascript" type="text/javascript" src="tableSort.class.js"></script> </head> <body> <table border="0" cellspacing="0" cellpadding="0" id="bodys"> <tr> <td width="45">选择</td> <td width="50">数字</td> <td width="50">字母</td> <td width="80">名字</td> <td width="150">地址</td> <td width="80">时间</td> </tr> <tr> <td><input type="checkbox" checked></td> <td>1</td> <td>a</td> <td>谢诗圆</td> <td>http://www.php.cn/;/td> <td>2007-12-16</td> </tr> <tr> <td><input type="checkbox" checked></td> <td>4</td> <td>c</td> <td>auntion</td> <td>http://www.php.cn/;/td> <td>2006-12-06</td> </tr> <tr> <td><input type="checkbox"></td> <td>3</td> <td>b</td> <td>疯狂的石头</td> <td>http://www.php.cn/;/td> <td>2007-03-12</td> </tr> <tr> <td><input type="checkbox"></td> <td>3.2</td> <td>d</td> <td>谢某人</td> <td>http://www.php.cn/;/td> <td>2000-01-01</td> </tr> <tr> <td><input type="checkbox" checked></td> <td>5</td> <td>f</td> <td>小小强</td> <td>http://www.php.cn/;/td> <td>2008-12-31</td> </tr> <tr> <td><input type="checkbox"></td> <td>7</td> <td>e</td> <td>疯狂的man</td> <td>http://www.php.cn/;/td> <td>2006-11-12</td> </tr> <tr> <td><input type="checkbox"></td> <td>71</td> <td>g</td> <td>小强</td> <td>http://www.php.cn/;/td> <td>2002-08-23</td> </tr> <tr> <td><input type="checkbox" checked></td> <td>8</td> <td>h</td> <td>王庆</td> <td>http://www.php.cn/;/td> <td>1999-08-25</td> </tr> </table> <script language="javascript" type="text/javascript"> var apply = new tableSort("bodys","tag"); apply.toTagStart(); //这里将使用已经定义的一种默认触发方式. </script> </body> </html>
以上就是Auntion-TableSort javascript类文件_javascript技巧的内容。
DOM在纯JavaScript中实现?
有env.js,但这需要Rhino.
有jsdom,但这需要Node.
有没有解决方案可以在大多数任何JavaScript解释器(例如v8)中运行,而不被绑定到任何特定的解释器或引擎?也就是说,JS中是否有任何DOM实现,没有任何设置或垫片可以放入javascript解释器,只是运行?
解决方法
javascript onmouseout 解决办法_javascript技巧
onmouseout 发现它的触发太敏感,当经过层内文字链时,即触发onmousetout事件,功能不能正常显示,经过一番搜索,整理出来,供大家参考。
1、
faddsf
2、
var LeaveFunext = function(t,f){for(var p in f){t[p]=f[p]} return t};
var IE = ''\v'' == ''v'';
var contains = function(wrap,child){
if(IE) return wrap.contains(child);
while(child && typeof(child.parentNode) != "undefind"){
if(wrap == child) return true;
child = child.parentNode;
}
return false;
};
var LeaveFun = function(o){
var _o = typeof o =="string" ? document.getElementById(o) : o;
return this == window ? new LeaveFun(_o):LeaveFunext(_o, LeaveFun.prototype);
};
LeaveFun.prototype = {
mouseleave : function(fn){
if(IE){
this.attachEvent(''onmouseleave'',fn);
}else{
this.addEventListener(''mouseout'',function(e){
tar = e.relatedTarget;
if(!contains(this, tar)){
fn.call(this);
}
}, false);
}
return this;
}
};
//调用
LeaveFun(''share_customerdiv'').mouseleave(function(){document.getElementById(''share_customerdiv'').style.display =''none'';})