最大化
option(alt) 点击左上角绿色按钮 最大化(不是全屏)
全屏
ctrl+command+f
1 | var clone = Object.assign({}, {a: 1, b: 2, c: 3}); |
这个不完美
1 | var clone2 = Object.assign({}, {a: 1, b: 2, c: 3}, {b: undefined}); |
1 | const x = {a: 1, b: 2, c: 3, z:26}; |
1 | const obj = { a: 1, b: 2, c: 3, d: 4 } |
lodash
1 | _.omit(x, 'b') |
package.json 的 eslintConfig(如果已经有 eslintrc.js )
1 | "rules": { |
1 | let a = {a:1,b:{c:{d:2}}} |
via https://www.samanthaming.com/tidbits/70-3-ways-to-clone-objects/
1 | const purchase = [ |
两头对齐
1 | Masks 9.99 |
1 | const bankNumber = '2222 2222 2222 2222'; |
类似滴:
deep copy (or deep clone): lodash _.cloneDeep, Ramda, a custom function, JSON.parse() / JSON.stringify(), and rfdc
For the best performance, the library rfdc (Really Fast Deep Clone) will deep copy about 400% faster than lodash’s _.cloneDeep
const a = new Object();
对象字面量
const a = {};
es5
const a = '123' const obj = { a:a }
es6
const a = '123' const obj = { a } // 属性从同名变量找
es5
`
const a = {
a:function(){
}
}
`
es6
`
const a = {
a(){
}
}
`
const skill = '安邦' const david =
文能${skill}
var heat = '50%'; var field = 'Rock and Roll'; var music = { [field.toLowerCase()]: heat } console.log(music); // Object {rock and roll: "50%"}
let music = { type: 'rock', heat: '50%' }; let { type, heat } = music; console.log(type, heat); // rock 50%
对象解构 重命名
let music = { type: 'rock', heat: '50%' } let { type: aaa, heat: bbb } = music; console.log(aaa, bbb); // rock 50%
let people = [20, 25, 30] let [young, oldYoung] = people; console.log(young, oldYoung) // 20 25
https://zh.wikipedia.org/wiki/%E6%AD%BC-10
11 15 16 20 35 22
1 | defaults write com.apple.dock persistent-others -array-add '{ "tile-data" = {"list-type" = 1; }; "tile-type" = "recents-tile";}' && \killall Dock |
手机扫描二维码 藏在 设置 - 已关联设备
将 Signal Desktop 与手机关联的步骤:
安装并打开 Signal Desktop。
在你的手机上,打开信速达转到信速达的设置界面profile_avatar.png > 登录过的设备。
按下+图标(安卓)或是”登录新的设备”(苹果)
用你的手机来扫描二维码。
选取一个你登录过的设备然后点击完成。
从 Signal Desktop 发送一条信息。
1 | var numbers = [15.5, 2.3, 1.1, 4.7]; |
1 | var numbers = [15.5, 2.3, 1.1, 4.7]; |
1 | <div id="parent"> |
in main.js
1 | export const bus = new Vue() |
in Parent.vue:
1 | import {bus} from 'path/to/main' |
// Where you wanna call the child’s method:
1 | bus.$emit('customEventName', optionalParameter) |
in Child.vue:
1 | import {bus} from 'path/to/main' |
// Add this to the mounted() method in your component options object:
1 | bus.$on('customEventName', this.methodYouWannaCall) |
1 | import ChildForm from './components/ChildForm' |
组件代码
1 | <template> </template> |
组件内,返回 除 class style props 以外的 其他属性
1 | console.log(this.$attrs); |
1 | console.log(this.$root.$children[0].$children[0].$data); |
$createElement:
$el:
$listeners:
$options:
$root:
$scopedSlots:
$slots:
$vnode:
$on 的事件可在 created 或 mounted 注册
需在 beforeDestroy 或 destoryed 的时候使用用 $off 销毁
否则在某些情况下会被被多次触发
this.EventBus.$off(‘map_is_ready’);
全部 cancel
this.EventBus.$off();
vue.config.js 中添加
1 | module.exports = { |
本机域名 在
/etc/hosts