Symbol(<имя>)
- создание нового символа. Чтобы получить значение по сиволу, надо иметь на руках ссылку на этот сиvвол. Из документации:Symbol("foo") === Symbol("foo"); // false
class Animal {}
class Cat {}
const animal = new Animal();
const cat = new Cat();
console.log(animal instanceof Animal); // true
console.log(animal instanceof Cat); // false
console.log(cat instanceof Animal); // false
console.log(cat instanceof Cat); // true
Reflect.setPrototypeOf(Cat.prototype, Animal.prototype);
console.log(animal instanceof Animal); // true
console.log(animal instanceof Cat); // false
console.log(cat instanceof Animal); // true
console.log(cat instanceof Cat); // true
const extendMe = ({prototype: childProto}, {prototype: parentProto}) => {
for (const key of Object.getOwnPropertyNames(parentProto)) {
if (!(key in childProto)) {
childProto[key] = parentProto[key]
}
}
}
class Animal {
name () { return 'Животное' }
legs () { return undefined }
get isAnimal () {
return true
}
}
class Cat {
name () { return 'Котик' }
legs () { return 15 }
}
const cat = new Cat()
console.log(cat.isAnimal) //undefined
extendMe(Cat, Animal)
console.log(cat.isAnimal) // true
# сборка
npm run build
# переход в каталог итоговой сборки
cd dist
git init
git add -A
git commit -m 'deploy'
git push -f git@bitbucket.org:<USERNAME>/<USERNAME>.bitbucket.io.git master
width: auto !important;
white-space: nowrap;
<a :class="{active: item == currentlyActiveItem}">{{item}}</a>
mapGetters(['doneTodosCount'])
превращается в{
doneTodosCount() {
return this.$store.getters.doneTodosCount;
},
}
@click="testClickGo().restart"
targets: '.testVal',
data: () => ({
anime: null,
}),
mounted() {
this.anime = this.$anime({
targets: this.$refs.animeEl,
translateX: 200,
delay: 800,
});
},
<h1 ref="animeEl">hello, world!!</h1>
<button @click="anime.restart()">click me</button>