摘要:
网页布局(layout)是CSS的一个重点应用。 布局的传统解决方案,基于盒状模型,依赖 display属性 + position属性 + float属性。它对于那些特殊布局非常不方便,比如,垂直居中就不容易实现。 2009年,W3C提出了一种新的方案—-Flex布局,可以简便、完整、响应式地实现各 阅读全文
摘要:
函数fun的caller返回调用fun的函数对象,即fun的执行环境,如果fun的执行环境为window则返回null function fun(){ console.log(fun.caller)//这里必须写在fun里面,因为caller只有函数执行过程中才有效}//结果为:null 下面包裹一 阅读全文
摘要:
//返回jsonp格式$callback = $_GET['callback'];$arr = array('error_code'=>'1');printf("%s(%s);", $callback, json_encode($arr)); //$arr为返回数据 阅读全文
摘要:
get请求axios.get('/user', { params: { ID: 12345 } }) .then(function (response) { console.log(response); }) .catch(function (error) { console.log(error); 阅读全文
摘要:
async 总是返回一个promise async function f() { return 1 } f().then(alert) // 1 我们也可以显式的返回一个promise,这个将会是同样的结果: async function f() { return Promise.resolve(1 阅读全文
摘要:
async function test() { console.log('Hello') await sleep(1000) console.log('world!')} function sleep(ms) { return new Promise(resolve => setTimeout(re 阅读全文
摘要:
<div class="click-box" :style="{'top':top+'px','left':left+'px'}" @click="clickBox"> 阅读全文
摘要:
ES6 : import对应的是export default 或 export require对应的是module.exports 或 exports export导出多个对象, export default只能导出一个对象 exports只能使用语法来向外暴露内部变量:如 exports.xxx 阅读全文
摘要:
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>test</title> <link rel="stylesheet" type="text/css" href="css/test.css"> </head> 阅读全文
摘要:
a继承b <script> function b(){ this.bname = "99"; } function a(){ this.aname = "5"; } a.prototype = new b(); a.prototype.cname = "66"; var a = new a(); c 阅读全文