/Exploration

A place that I have explored in network.Including some demos which tech I have tested, managing my own knowledge, and saved some articles.

Primary LanguageJavaScript

Exploration

A place that I have explored in network.Including some demos which tech I have tested, managing my own knowledge, and saved some articles.

碎碎念

记录一些零碎的东西

2020-06-29

12:05

学习的时候先找准主题,集中式的去搜集资料,然后学习。最好学习的过程中能带着问题去解决,比如学习这个主题,是要解决什么问题,要达到怎样一种效果。

2020-03-01

for...in循环的是key,for...of循环的是value,对象不能使用for...of进行遍历

使用for...in遍历数组时,如果有自定义key,自定义key也会遍历,如果用for...of,只会遍历数组中的value,而不会遍历出自定义key的值

2020-01-15

MacOS 逆向

如何在现有项目中pod install

2020-01-13

VuePress

在styl中使用绝对路径来处理图片路径问题,暂时没去找其他的解决方案了。

background-image: url('/images/bg4.jpg')

2020-01-10

Experience

附件的deleted字段都为true了,相当于需要保存的数据为空,这个时候没有做判断.

Markdown 锚点

[Content](#anchor)

<span id="anchor"></span>

2020-01-03

JSON.stringify 序列化的对象不能包括自己本身,否则会报错。

2020-01-02

Vue

$emit会有性能开销,如果处理的数据较多,$emit次数过多的话,会导致性能崩掉。类似于selection-change这种操作,不应该触发子元素的emit事件。及组件内部的修改,不应该触发子组件的emit

2019-12-21

Webpack require.context

第三个参数用来去匹配获取的路径,是否满足正则条件。该方法获取的路径如下:

./FileUtils.js
./StringUtils.js
./Test/T/index.js
./Test/index.js
./Test/router/index.js
./index.js
./init.js

Webpack 会用正则去跟这些路径做比较,满足条件的就会被留下来。

2019-12-20

Mac DNS Lookup

Open alfred or spotlight to search Network tools, select lookup, enter the site to find the ip.

Or use nslookup in terminal.

2019-12-18

VS Code

Use cmd+enter to create a new line below, or use cmd+shift+enter to create a new line above.

2019-12-16

Markdown table style

Use like this:

<style>
.numeric-conversion-rules table th:first-of-type {
  width: 150px;
}
</style>
<div class="numeric-conversion-rules">

  |__Head1__|__Head2__|
  |---------|---------|
  |  body1  |  body2  |

</div>

Vue url resolve

Use ~ to resolve path in <template>. Like this:

<img src="~p@/img.png" />

2019-12-13

Excel 条件格式

// $ means absolute path
// $A$1 $A1 A$1 A1
=IF(AND(OR(IF($K3<>"", 1, 0), IF($L3<>"",1,0)), IF(R3="",1,0)),1,0)

Excel Freeze table header

  1. Select A3
  2. Click freeze

2019-12-12

JavaScript class

class Test {
  constructor(name) {
    this.name = name;
  }

  get name() {
    return this.name;
  }

  set name(val) {
    this.name = val;
  }
}

If use setter/getter like above, while occur below error.

Uncaught RangeError: Maximum call stack size exceeded

The correct way is to use like below:

class Test {
  constructor(name) {
    this.name = name;
  }

  get name() {
    return this._name;
  }

  set name(val) {
    this._name = val;
  }
}

Use a temp variable to store the value.

Vue $scopedSlots

If bind scope to slot, use this to instead of $slots.

Vue mixins

// Input.vue
<script>
import { Input } from 'element-ui';

export default {
  mixins: [Input],
  props: {
    size: {
      default: 'mini',
    },
  },
  mounted() {
    this.$on('input', (e) => {
      console.log(e);
    });
  },
};
</script>

If use this way to set default props to a component, also can use below way to listener to event.

<input @input="input">