#html
ol/ul > li 会自动缩进,并且由于 ol 会自动添上 list 的 marker ,单纯使用 padding-left 取消缩进会发现 list 的 marker 位置不对了
正确的取消缩进的方法除了修改
关于
https://developer.mozilla.org/en-US/docs/Web/CSS/list-style-position
ol/ul > li 会自动缩进,并且由于 ol 会自动添上 list 的 marker ,单纯使用 padding-left 取消缩进会发现 list 的 marker 位置不对了
正确的取消缩进的方法除了修改
padding-left 为 0 之外还需要使用 css list-style-position: outside; 调整 marker 位置关于
list-style-position 这个 css 可以看这里https://developer.mozilla.org/en-US/docs/Web/CSS/list-style-position
MDN Web Docs
list-style-position - CSS | MDN
The list-style-position CSS property sets the position of the ::marker relative to a list item.
#小程序
我讨厌微信小程序的一个原因就是你永远也不知道你回遇到什么样的 BUG
微信小程序 background 透明度 BUG
解决方案 使用 rgba 的形式表示????
我讨厌微信小程序的一个原因就是你永远也不知道你回遇到什么样的 BUG
微信小程序 background 透明度 BUG
/* 微信开发工具预览正常 Iphone 正常 Android 不正常 可能和基础库版本有关系 */
background: #00000080
/* 解决方案 使用 rgba 的形式表示 */
background: rgba(0, 0, 0, 0.5);
解决方案 使用 rgba 的形式表示????
#小程序
父组件如何调用子组件的方法?
通过 this.selectComponent 方法获取子组件实例对象,这样就可以直接访问组件的任意数据和方法
具体操作方式如下
父组件如何调用子组件的方法?
通过 this.selectComponent 方法获取子组件实例对象,这样就可以直接访问组件的任意数据和方法
具体操作方式如下
<!-- index.xtml -->
<com id="child" />
// index.js
const child = this.selectComponent('#child')
child.go()
#js
如何判断一个变量是
这么做比分别判断简单多了
如何判断一个变量是
null or undefinedif ( some_variable == null ){
// some_variable is either null or undefined
}这么做比分别判断简单多了
#js
safari 的 date 解析和 chrome 相比有很多种格式不支持
简单粗暴的解决方案
[Invalid date in safari
](https://stackoverflow.com/questions/4310953/invalid-date-in-safari)
safari 的 date 解析和 chrome 相比有很多种格式不支持
// safari
new Date('2000-04-12 00:00:00 GMT+0000')
// Invalid Date
// chrome
new Date('2000-04-12 00:00:00 GMT+0000')
Wed Apr 12 2000 00:00:00 GMT+0000
简单粗暴的解决方案
new Date('2000-04-12 00:00:00 GMT+0000'.replace(/-/g, '/'))[Invalid date in safari
](https://stackoverflow.com/questions/4310953/invalid-date-in-safari)
Stack Overflow
Invalid date in safari
alert(new Date('2010-11-29'));
Chrome, Firefox doesn't have problems with this, but Safari cries "invalid date". Why?
edit : ok, as per the comments below, I used string parsing and trie...
Chrome, Firefox doesn't have problems with this, but Safari cries "invalid date". Why?
edit : ok, as per the comments below, I used string parsing and trie...
#js
某位前辈在网络请求的 Promise 处理玩异常后直接 return 结束了函数,没有 reject 异常。。
结果就是这个 Promise 一直处于 pending 状态,无论使用 catch 还是 finally 都无法继续执行,及其坑爹。。
某位前辈在网络请求的 Promise 处理玩异常后直接 return 结束了函数,没有 reject 异常。。
结果就是这个 Promise 一直处于 pending 状态,无论使用 catch 还是 finally 都无法继续执行,及其坑爹。。
Forwarded from Parallel Experiments (Linghao Zhang)
Re:Linked
乱码恢复指北
Blog of Outvi V
#js
判断一个变量是否是 object
我第一反应是用
但是 null 也是 object type
因此大部分场景还需要过滤 null
正确写法
判断一个变量是否是 object
我第一反应是用
typeof myObj === 'object'但是 null 也是 object type
因此大部分场景还需要过滤 null
正确写法
typeof yourVariable === 'object' && yourVariable !== null
Forwarded from YSC 的频道
#WSL 中使用 npm 可能会遇到 syscall rename EACCESS 的问题,可以使用 wslunpindir 来解决。
GitHub
GitHub - fuzzyTew/wslunpindir: A partial workaround for Windows pinning Linux directories because they are in use.
A partial workaround for Windows pinning Linux directories because they are in use. - fuzzyTew/wslunpindir
YSC 的频道
#WSL 中使用 npm 可能会遇到 syscall rename EACCESS 的问题,可以使用 wslunpindir 来解决。
这个问题我没遇到过,npm 更经常遇到的问题是
几种解决方案官方已经写清楚了,可以自己查阅(嫌麻烦也可以直接
Resolving EACCES permissions errors when installing packages globally
https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally
npm install -g 时的 EACCES permissions errors 几种解决方案官方已经写清楚了,可以自己查阅(嫌麻烦也可以直接
sudo 但是不推荐Resolving EACCES permissions errors when installing packages globally
https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally