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
var settings = {}; | |
arr = [ | |
{name: 'Ruslan', age : '34'}, | |
{name: 'Andrew', age : '56'}, | |
]; | |
arr.forEach(el => { | |
console.log(el.name) | |
settings[el.name] = el.age |
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
var filmsLIst = [] | |
function fetchFilms(counter){ | |
console.log(counter) | |
fetch(`https://www.omdbapi.com/?s=comedy&page=${counter}&apikey=4b0ceb69`) | |
.then(data => data.json()) | |
.then(resp => { | |
console.log(resp.Search) | |
resp.Search.forEach(el => { | |
console.log(el); |
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
$(document).on('click', '.mobile_phones-box', function() { | |
$('.phone').slideToggle(400, function (){ | |
if ($(this).is(':hidden')) { | |
console.log("closed"); | |
} else { | |
$('body, html').animate({ scrollTop: 0 }, 300); | |
console.log("open"); | |
} | |
}); | |
}); |
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
//data | |
data(){ | |
return{ | |
user:{ | |
name: 'Andrew', | |
age: '20' | |
} | |
} | |
} |
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
//reactive property | |
this.$set(this.user, 'position', 'HR') | |
//not reactive | |
Object.assign(this.user, {'Weight' : '100'}); |
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
new Vue({ | |
el: '#app', | |
data: { | |
terms: false | |
}, | |
computed: { | |
isDisabled: function(){ | |
return !this.terms; | |
} | |
} |
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
// store.js | |
export default new Vuex.Store({ | |
state:{ | |
tasks: JSON.parse(localStorage.getItem('tasks') || '[]') | |
}, | |
mutations: { | |
createTask(state, payload){ | |
state.tasks.push(payload); |
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
// create eBus variable in main.js | |
export const eBus = new Vue(); | |
// import ebus to component | |
import {eBus} from '../main' | |
methods:{ | |
changeName () { | |
//create custom event | |
eBus.$emit('CHANGE_NAME', this.userName); |
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
import Vue from 'vue' | |
import Router from 'vue-router' | |
import Home from './views/Home.vue' | |
import Login from './views/Login.vue' | |
Vue.use(Router) | |
export default new Router({ | |
mode: 'history', | |
base: process.env.BASE_URL, |
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
const mix = require('laravel-mix'); | |
require('laravel-mix-polyfill'); | |
/* | |
|-------------------------------------------------------------------------- | |
| Mix Asset Management | |
|-------------------------------------------------------------------------- | |
| | |
| Mix provides a clean, fluent API for defining some Webpack build steps |