摘要: 一、css实现 eg: <html lang="zh-ch"> <head> <meta charset="utf-8" /> <title>test</title> <style> .test { width: 100px; height: 100px; } .lr-tb { direction: 阅读全文
posted @ 2022-07-27 16:22 阳光下的向日葵 阅读(1292) 评论(0) 推荐(0)
摘要: eg: <!DOCTYPE html > <html> <head> <meta charset="utf-8" /> <title>test</title> <style > .box{ writing-mode: tb-rl;/*决定文字排版方向*/ width: 120px; height: 阅读全文
posted @ 2022-07-27 15:27 阳光下的向日葵 阅读(1120) 评论(0) 推荐(0)
摘要: @media (min-width: 376px){ html{ font-size: 8px; } } @media (min-width: 415px){ html{ font-size: 8px; } } @media (min-width: 640px){ html{ font-size: 阅读全文
posted @ 2022-07-27 11:01 阳光下的向日葵 阅读(569) 评论(0) 推荐(0)
摘要: 百度百科:NaN(Not a Number,非数字)是计算机科学中数值数据类型的一类值,表示未定义或不可表示的值。虽然 NaN 是“Not a Number”,但是它的类型还是数值类型 console.log(typeof NaN "number"); //true NaN 和任何东西都不相等——甚 阅读全文
posted @ 2022-07-20 09:36 阳光下的向日葵 阅读(849) 评论(0) 推荐(0)
摘要: 一、相似性: 1、在JavaScript中将某个变量赋值为undefined或null,实际上没有太大的差别,两者都是表示某个变量的值为“空”。 2、undefined和null在if语句中,都会被自动转为false,相等运算符甚至直接报告两者相等。 if(!undefined) console.l 阅读全文
posted @ 2022-07-19 16:01 阳光下的向日葵 阅读(1960) 评论(0) 推荐(1)
摘要: eg: var y = 10; if (!(x in window)) { var x = 10; } else { ++y; } console.log(x); //undefined console.log(y); //11 说明:开始 x=undefined 但 undefined in wi 阅读全文
posted @ 2022-07-07 15:45 阳光下的向日葵 阅读(31) 评论(0) 推荐(0)
摘要: eg: var number = 50; var obj = { number: 60, getNum: function () { var number = 70; return this.number; } }; console.log(obj.getNum());//60 this的指向为ob 阅读全文
posted @ 2022-07-06 16:21 阳光下的向日葵 阅读(66) 评论(0) 推荐(0)
摘要: 在JavaScript中,每个函数都有call()和apply()方法。 var some_obj={ name:'Ninja', say:function(who){ return 'Haya ' + who + ', I am a '+ this.name; } }; some_obj.say( 阅读全文
posted @ 2022-07-01 17:44 阳光下的向日葵 阅读(23) 评论(0) 推荐(0)
摘要: 在vue中使用mvvm(model-view-viewModel)双向绑定获取表单数据。如果习惯原生操作dom的方式,可以使用vue的ref属性来获取表单的数据。 <template> <div id="app"> <p>{{message}}</p> <input type="text" v-mo 阅读全文
posted @ 2022-04-21 16:23 阳光下的向日葵 阅读(748) 评论(0) 推荐(0)
摘要: setTimeout的运行机制: 先将回调函数放到等待队列中,等待区域内其他主程序执行完毕后,按时间顺序先进先出执行回调函数。本质上是作用域的问题。 在for循环中使用setTimeout时: for (var i=1; i<=5; i++) { setTimeout( function timer 阅读全文
posted @ 2022-03-30 14:12 阳光下的向日葵 阅读(409) 评论(0) 推荐(0)