This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 在 CSS flexbox 布局出现以前,如果要控制 HTML 元素的布局,要用到很多种奇葩的方式。在水平方向上得用`float`控制左右对齐,稍一不注意,就会有浮动的元素飞来飞去~。在垂直方向上就更是百家争鸣了:要么手动计算高度然后算出中心点,要么用 `line-height` 和 `height` 的结合,要么用十之八九不生效的 `vertical-align` 属性等等等等。自从 flex-box 出现以后,一切似乎就豁然开朗了,水平垂直各种花式对齐,空间分配由你做主。当然,要用好它,用对它也不是一件容易的事,今天就给你说说 flex-box 布局,看完之后你也能熟练的运用它!(博客中的示例都是真实的 HTML 代码,可以使用 chrome 开发者工具查看属性。(此文为了演示某些 flex 示例,在小屏幕下会有横向滚动条) | |
| ## 开启 Flexbox 布局 | |
| 假设有下边这么一个 html 结构: | |
| ```html | |
| <div class="flex"> | |
| <div class="flex1">Flex 1</div> | |
| <div class="flex2">Flex 2</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 父组件的 scoped 样式不能穿透到子组件上。 | |
| 使用 vue-loader 的写法。 | |
| 有人用去掉 scoped 的方法解决,但这会污染全局样式,不可取。 | |
| 使用 /deep/ 或者 >>> 解决 | |
| `/deep/` | |
| ```css | |
| .child /deep/ span { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| router.js | |
| ```JavaScript | |
| router.beforeEach((to, from, next) => { | |
| if (to.matched.some(record => record.meta.requireAuth)){ // 判断该路由是否需要登录权限 | |
| if (token) { // 判断当前的token是否存在 | |
| next(); | |
| } | |
| else { | |
| next({ | |
| path: '/login', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## 脚本介绍 | |
| 该脚本基于 [Github - UnblockNeteaseMusic](https://github.com/nondanee/UnblockNeteaseMusic) 项目。\ | |
| UnblockNeteaseMusic 是一个专门针对网易云音乐解锁灰色无版权音乐的代理工具,通过替换经过代理的无版权音乐链接为其他音源(如:QQ音源、酷我、酷狗、百度音乐、咪咕、JOOX等)来实现解锁网易云音乐无版权音乐。 | |
| **相当于在网易云音乐客户端中听全网版权音乐(相对)!** | |
| !> **·** 该脚本只适用于服务器,如果只想在本地使用,请使用我写的 [Windows 版 UnblockNeteaseMusic](https://zhuanlan.zhihu.com/p/79631291)! | |
| **·** **建议有条件的部署在国内服务器**,国外服务器只能用 QQ 音源(其他的音源不允许国外访问),况且部署在国外服务器相比国内或者本地速度会慢上不少(具体取决服务器与你之间链接的质量)。 | |
| ### 脚本版本 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ```html | |
| <h1 class=“css-jump”> | |
| <span>C</span> | |
| <span>S</span> | |
| <span>S</span> | |
| <span>跳</span> | |
| <span>动</span> | |
| <span>文</span> | |
| <span>字</span> | |
| </h1> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ### 在float的父元素添加clearfix | |
| html | |
| ```html | |
| <div class="ly clearfix"> | |
| <img src="/images/Heroes/picture/pic.jpg" width="71" height="77" /> | |
| </div> | |
| ``` | |
| css |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| html | |
| ```html | |
| <div class="entry-wrapper"> | |
| <h2 class="entry-title"> | |
| <a> | |
| CSS两端对齐 | |
| </a> | |
| </h2> | |
| <div class="tools"> | |
| <button type="button"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|  | |
| 问题: 可能很多人在做vue项目打包,打包之后js中,会自动生成一些map文件,怎么把它去掉不要呢? | |
| 运行 cnpm run build 开始打包后会在项目目录下自动创建dist目录,打包好的文件都在其中 | |
| 解决办法:去config/index.js中改一个参数: | |
| productionSourceMap:false | |
| 把这个改为false。不然在最终打包的文件中会出现一些map文件 | |
| map文件的作用:项目打包后,代码都是经过压缩加密的,如果运行时报错,输出的错误信息无法准确得知是哪里的代码报错。 | |
| 有了map就可以像未加密的代码一样,准确的输出是哪一行哪一列有错。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 在nginx.conf中通过 | |
| ```bash | |
| find / -name nginx.conf | |
| ``` | |
| 假如查找的位置在`/etc/nginx/nginx.conf`就在`nginx.conf`的http 块下加一句`include conf.d/*.conf;`就可以了 | |
| 编辑nginx.conf | |
| ```nginx | |
| # 包含所有的虚拟主机的配置文件 | |
| include conf.d/*.conf; | |
| # 这表示,包含相对目录conf.d下,所有以.conf后缀的配置文件的信息。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 查看DNS缓存 | |
| 在cmd命令窗口 | |
| > ipconfig/displaydns | |
| 清理DNS缓存 | |
| >ipconfig/flushdns |