前端知識點總結
1 HTML
1.1 組成
HTML標籤: 單 雙 HTML標籤屬性 class id
1.2 HTML標籤
1.3 塊狀元素好內聯元素
#塊狀 塊級 獨佔一行 div p hr br tr table header footer h1 h2 h3 ... 佈局的元素 格式類 列表 #內聯 行內 span em strong a img input button sub sup del ... 文本類、表單控件
2 CSS
2.1 CSS選擇器
2.2 取值
長度單位 px em 百分比 rem 顏色單位 colorName rgb() rgba() HEX 十六進制 hsl() hsla()
2.3 CSS屬性
3 JavaScript
3.1 基本語法
指令結束符 ;或者換行 註釋 // /* */ 變量 變量名規範 (不能是關鍵字)
3.2 數據類型
String Number Boolean Null Undefined Object Array Function ........ RegExp
3.3 運算符
算術 ++ -- + - * / % **(ES6) 比較 > >= < <= == != === !== 邏輯 && || ! 位運算符 賦值 = += -= /= *= %= 其餘 +(字符串拼接) typeof delete ?:
3.4 內置對象
# String對象 length substr() substring() slice() indexOf() lastIndexOf() search() 能夠寫正則 split() trim() # Number toFixed() toString() # Array length --------------------- push() unshift() pop() shift() splice() reverse() sort() -------------------- concat() join() indexOf() lastIndexOf() ---------------------- forEach() map() filter() some() every() reduce() # Function apply() call() # Math PI abs() pow() max() min() ceil() floor() round() random() # Date getFullYear() getMonth() getDate() getDay() getHours() getMinutes() getSeconds() getMilliseconds() getTime() getUTC.... set... setUTC... #RegRxp test() exec() 字符串方法: search() match() replace()
4 BOM/DOM
4.1 BOM
瀏覽器對象模型 #window 瀏覽器中運行JS的全局對象 setInterval() setTimeout() clearInterval() clearTimeout() alert() confirm() prompt() innerWidth innerHeight #histroy back() go() forward() #navigator userAgent #screen #location href path hostname hash .....
4.2 DOM
文檔對象模型 獲取頁面元素 querySelector() querySelectorAll() 操做元素的內容、屬性、樣式 document document.body body元素 document.documentElement html元素
4.3 事件 Event
# 綁定事件 dom.addEventLister() dom.on事件 = function(){} <p onclick="code..."> # 事件 鼠標 click dblclick contextmenu mouseenter mouseleave mousemove mousedown mouseup 鍵盤 keydown keyup keypress 表單 blur focus submit reset select change input 文檔 load unload beforeunload 圖片 load error abort 其餘 scroll resize # Event對象 keyCode clientX/clientY offsetX/offsetY pageX/pageY button target stopPropagation() preventDefault()
5 jQuery JS庫
5.1 基礎
jquery DOM 對象 和 JS dom區別 、 轉換 連貫操做
5.2 選擇器
5.3 篩選器
# 過濾 first() last() eq(index) not() filter() has() slice() # 查找 parent() parents() offsetParent() parentsUntil() children() find(選擇器) prev() prevAll() prevUntil() next() nextAll() nextUntil() siblings() closest(選擇器) # 串聯 add(選擇器) addBack() end()
5.4 DOM操做 文檔操做
# 內部插入 append() appendTo() prepend() prependTo() # 外部插入 after() insertAfter() before() insertBefore() # 包裹 wrap() wrapAll() wrappInner() unwrap() # 替換 replaceWith() replaceAll() # 刪除 empty() remove() # 克隆 clone()
5.5 樣式操做
#css css() # 尺寸 width() / height() innerWidth() / innerHeight() outerWidth() / outerHeight() # 位置 offset() postion() scrollLeft() scrollTop()
5.6 屬性
# 屬性 attr() removeAttr() prop() removeProp() # class addClass() removeClass() toggleClass() hasClass() # 取值 text() html() val()
5.7 事件
#綁定 on() one() #解除綁定 off() #委派 父元素.on('事件', ‘子元素’, fn) # 自動觸發事件 $('btn').trigger('click') # jqueyr 事件 # Event
5.8 jQuery 動畫
# 基本 show() hide() toggle() # 滑動 slideUp() slideDown() slideToggle() # 淡入淡出 fadeIn() fadeOut() fadeToggle() fadeTo() # 自定義動畫 animate() # 動畫控制 delay() finish() stop()
5.9 jquery插件
6 Boostrap UI樣式庫
6.1 基礎
響應式 media bootstrap.css bootstrap.js 依賴於jquery
6.2 佈局
柵格系統 表格 表單 .....
6.3 組件
字體圖標 按鈕 導航條 ..
6.4 插件
模態框 輪播圖 .....
7 Vue JS框架
7.1 Vue實例
new Vue ({ el:, template:, render:, data:, computed:, watch:, methods:
7.2 Vue視圖語法 (模板語法)
7.3 組件
# 註冊組件 Vue.component(組件名, { props data: function(){ } 同vue實例 comonents: { 局部組件 } }); # 組件通訊 父組件->子組件 prop 子組件->父組件 $emit() 自定義事件 # 插槽 # 動態組件 <component is="組件名">
7.4 項目
# 前端工具 支持環境 node.js # 包管理工具 npm # 模塊化 webpack ... # 自動化工具 grunt glup webpack # Vue全家桶 vue vue-router vuex vue-ssr 服務端渲染 element-ui