http-request事件用在哪了
由于那個nav1的父盒子是固定定位了的,沒有設(shè)定高度,高度默認就和內(nèi)容高度相同了,而使用padding之后,拖沒內(nèi)容,它也是有高的,高度的計算你應該知道是怎么一回事。
這種情況就不要使用padding了,用定位來解決。或者使用事件來動態(tài)更改padding的值。這樣的話,可以嘗試Ctrl+Shfit+n打開隱身模式的Tab再進行調(diào)試,至少可以過濾掉chrome擴展的腳本
利用正則工具MTracer ^d+$ 可以匹配多個正整數(shù)
因此,替換一下正則表達式即可
oninput="this.value=this.value.replace(/^d+$/,'')"
如果是同步的話,碰到開發(fā)者高頻率調(diào)用setState方法,比如在一個回調(diào)函數(shù)中調(diào)用多個函數(shù),每個函數(shù)都調(diào)用一次setState,React會頻繁渲染,性能和體驗都很差,所以采用了異步更新的方式,將數(shù)次變動集中起來更新。
避免這個異步更新問題的方法有兩種,一是采用樓上說的回調(diào)函數(shù),二是setState傳入一個函數(shù),如下
this.setState(prevState=>({
...prevState,
[propYouWantToChange]:valueYouWantToChange
}))
這個prevState每次都是新的,前提是在之前你沒有通過setState({})的方式改變過相關(guān)的屬性
這些基本都是模塊化方案,實際上自己頁很容易寫出模塊化的原理
如webpack
(function(modulesArr) {
var rootModule = {};
function __require__(id) {
if (rootModule[id]) {
return rootModule[id].exports;
}
var currentModule = modulesArr[id];
var module = {
id,
exports: {}
};
currentModule.call(module.exports, module.exports, module, __require__);
currentModule[id] = module;
return module.exports;
}
return __require__(0);
})([
function(exports, module, require) {
var m1 = require(1);
console.log(m1);
},
function(exports, module, require) {
exports.msg = 'Hello World';
var m2 = require(2);
m2();
},
function(exports, module, require) {
module.exports = function() {
var str = 'Hello World';
console.log(str);
return str;
};
}
]);
我自己實現(xiàn)的browser端模塊化
(function(global) {
'use strict';
var errMsg = Math.random().toString(32).substr(2);
var rootModule = {};
function ModuleCtor(id) {
if (!this || this.__proto__ !== ModuleCtor.prototype) {
return new ModuleCtor(id);
}
this.id = id;
this.exports = {};
this.loaded = !1;
}
function define(id, fn) {
if (typeof id === 'function') {
fn = id;
id = document.currentScript
? document.currentScript.src
: Math.random()
.toString(32)
.substr(2);
}
if (typeof id !== 'string') {
id = '' + id;
}
var module = ModuleCtor(id);
exec();
function __require__(src) {
if (rootModule[src] && rootModule[src].__proto__ === ModuleCtor.prototype) {
return rootModule[src].exports;
}
loadScript(src, function() {
exec();
});
throw new Error(errMsg);
}
function exec() {
try {
fn.call(module.exports, module.exports, module, __require__);
module.loaded = !0;
rootModule[id] = module;
} catch (err) {
if (err.message !== errMsg) {
throw err;
}
}
}
}
function loadScript(src, callback) {
var script = document.createElement('script');
script.src = src;
script.onload = function() {
callback && callback(src);
};
document.body.appendChild(script);
return script;
}
global.define = define;
})(window);
本質(zhì)都是js沒有模塊,所以我們就想到全局暴露一個rootModule對象,每一個鍵都是一個模塊,exports對象是依賴的暴露。
如a.js
module.exports = 'Hello World';
b.js
var chars = require('./a');
process.stdout.write(chars + '\n'); // Hello World
但是我們怎么實現(xiàn)呢,(一)編譯:如webpack,(二)暴露一個函數(shù),如requirejs、seajs。
webpack 可以配置 output libraryTarget: 'umd', library: 'globalVarName' 打題主說的這種umd包,兼容瀏覽器,requirejs,node環(huán)境。
另外我還是忍不住吐槽一下seajs的垃圾,一個文件的多個require發(fā)請求時沒有順序之分,字符串正則來分析依賴。。。如果jQuery的plugin依賴jQuery,需要對jQueryplugin改一下代碼討個套個客,不能直接想requirejs直接在config中聲明依賴。垃圾。當然我自己寫的模塊加載更垃圾,連依賴都不分析。多try幾次必然成功。
canvas上畫的球 你肯定能獲取到球的圓心坐標,只需要判斷你鼠標點擊的點和圓心的距離, 是否小于半徑,小于半徑就說明在圓內(nèi) 就可以出發(fā)點擊事件
float 會脫離文檔流,相當于飛起來了 :) 可以嘗試用 border-right
browserSync 很便捷的一個小插件,
配合vConsole可以實現(xiàn)實時刷新和在手機上調(diào)試
展示時后臺給的id不需要用,直接把name提取出來組成數(shù)組,然后選中的選項,根據(jù)value作為下標對應到后臺的id就可以了。需要前臺稍微寫點代碼的,并不麻煩。
這個是隊列,一次一個。
arr.toString===Array.prototype.toString
true
因為這個是數(shù)組啊。。。你可以認為數(shù)組繼承了對象的原型鏈但是對某些函數(shù)進行了改寫,那么自然就不能相對了。同理,你對一個對象tostring跟一個數(shù)組tostring能一樣嗎
其實用svg實現(xiàn)最好,
但如果最簡單只用css也可以
<div id="test">
<div id="box">88%</div>
</div>
#test{
position: relative;
width: 100px;
height: 100px;
border-radius: 50%;
background-color: red;
background-image: linear-gradient(54deg, red 50%, rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 0)), linear-gradient(270deg, red 50%, #fff 50%, #fff);//關(guān)鍵代碼
}
#box{
position: absolute;
width: 90px;
height: 90px;
top: 5px;
left: 5px;
background-color: #fff;
border-radius: 50%;
text-align: center;
line-height: 90px;
font-size: 16px;
}這個input標簽android端實現(xiàn)邏輯為瀏覽器自定義的,瀏覽器如果沒有實現(xiàn)無法兼容,很多瀏覽器沒有去實現(xiàn),不存在可以兼容的情況。
data() 中是取不到 computed 的值的,因為 computed 依賴于 data
而 created() 中 data 和 computed 就都已經(jīng)準備好了,所以你可以在 created 里手動給它賦值:
created () {
this.selectValue = this.SINGLE_GAME
}
打開瀏覽器控制臺觀察就能發(fā)現(xiàn)了,滾動時改變樣式opacity
width的默認單位是px吧,你是想要100%嗎
npm install -g vue-cli@版本號
查看版本號
vue -V自己解決了其實就是
//注釋
var ul = parent.find('ul:visible').slideUp(animationSpeed);
ul.removeClass('menu-open');
//注釋 removeClass("avtive")
parent.find('li.active').removeClass('');
代碼如下:
$.AdminLTE.tree = function (menu) {
var _this = this;
var animationSpeed = $.AdminLTE.options.animationSpeed;
$(document).off('click', menu + ' li a')
.on('click', menu + ' li a', function (e) {
//Get the clicked link and the next element
var $this = $(this);
var checkElement = $this.next();
//Check if the next element is a menu and is visible
if ((checkElement.is('.treeview-menu')) && (checkElement.is(':visible')) && (!$('body').hasClass('sidebar-collapse'))) {
//Close the menu
checkElement.slideUp(animationSpeed, function () {
checkElement.removeClass('menu-open');
//Fix the layout in case the sidebar stretches over the height of the window
// _this.layout.fix();
});
checkElement.parent("li").removeClass("active");
}
//If the menu is not visible
else if ((checkElement.is('.treeview-menu')) && (!checkElement.is(':visible'))) {
//Get the parent menu
var parent = $this.parents('ul').first();
//Close all open menus within the parent
// var ul = parent.find('ul:visible').slideUp(animationSpeed);
//Remove the menu-open class from the parent
// ul.removeClass('menu-open');
//Get the parent li
var parent_li = $this.parent("li");
//Open the target menu and add the menu-open class
checkElement.slideDown(animationSpeed, function () {
//Add the class active to the parent li
checkElement.addClass('menu-open');
parent.find('li.active').removeClass('');
parent_li.addClass('active');
//Fix the layout in case the sidebar stretches over the height of the window
_this.layout.fix();
});
}
//if this isn't a link, prevent the page from being redirected
if (checkElement.is('.treeview-menu')) {
e.preventDefault();
}
});
};
已通過查閱API解決
北大青鳥APTECH成立于1999年。依托北京大學優(yōu)質(zhì)雄厚的教育資源和背景,秉承“教育改變生活”的發(fā)展理念,致力于培養(yǎng)中國IT技能型緊缺人才,是大數(shù)據(jù)專業(yè)的國家
達內(nèi)教育集團成立于2002年,是一家由留學海歸創(chuàng)辦的高端職業(yè)教育培訓機構(gòu),是中國一站式人才培養(yǎng)平臺、一站式人才輸送平臺。2014年4月3日在美國成功上市,融資1
北大課工場是北京大學校辦產(chǎn)業(yè)為響應國家深化產(chǎn)教融合/校企合作的政策,積極推進“中國制造2025”,實現(xiàn)中華民族偉大復興的升級產(chǎn)業(yè)鏈。利用北京大學優(yōu)質(zhì)教育資源及背
博為峰,中國職業(yè)人才培訓領(lǐng)域的先行者
曾工作于聯(lián)想擔任系統(tǒng)開發(fā)工程師,曾在博彥科技股份有限公司擔任項目經(jīng)理從事移動互聯(lián)網(wǎng)管理及研發(fā)工作,曾創(chuàng)辦藍懿科技有限責任公司從事總經(jīng)理職務負責iOS教學及管理工作。
浪潮集團項目經(jīng)理。精通Java與.NET 技術(shù), 熟練的跨平臺面向?qū)ο箝_發(fā)經(jīng)驗,技術(shù)功底深厚。 授課風格 授課風格清新自然、條理清晰、主次分明、重點難點突出、引人入勝。
精通HTML5和CSS3;Javascript及主流js庫,具有快速界面開發(fā)的能力,對瀏覽器兼容性、前端性能優(yōu)化等有深入理解。精通網(wǎng)頁制作和網(wǎng)頁游戲開發(fā)。
具有10 年的Java 企業(yè)應用開發(fā)經(jīng)驗。曾經(jīng)歷任德國Software AG 技術(shù)顧問,美國Dachieve 系統(tǒng)架構(gòu)師,美國AngelEngineers Inc. 系統(tǒng)架構(gòu)師。