<div class="container"></div>
.container {
position: relative;
width: 500px;
height: 500px;
background-color: #c4c4c4;
}
.container::after {
content: "";
position: absolute;
top: 0;
right: 0;
width: 250px;
height: 250px;
border-top: 3px solid #00ff00;
border-right: 3px solid #00ff00;
}
let data = { id: 1 }
const first = [{ id: 3, value: 1 }, { id: 1, value: 4 }]
const second = [{ id: 2, value: 9 }, { id: 4, value: 2 }, { id: 1, value: 3 }]
let result = first.find(o => o.id === data.id)
if (!result) {
result = second.find(o => o.id === data.id)
if (!result) {
result = {}
}
}
data = {
...data,
...result
}
/articles/index.vue - просмотр списка статей
/articles/create.vue - создать статью
/articles/view.vue - смотреть статью
/articles/edit.vue - редактировать статью
{path: '/articles', component: './articles/index.vue'}
{path: '/articles/create', component: './articles/create.vue'}
{path: '/articles/:id', component: './articles/view.vue'}
{path: '/articles/:id/edit', component: './articles/edit.vue'}
clearInterval(1);
let leftOff = 0,
topOff = 0,
amount = 0,
speed = 200,
intervalId;
function move(){
if(leftOff < 200 && topOff <= 0){
$('#one').offset({
left: leftOff++
});
}else if(leftOff >= 200 && topOff < 200){
$('#one').offset({
top: topOff++
});
}else if(leftOff > 0 && topOff >= 200){
$('#one').offset({
left: leftOff--
});
}else if(leftOff <= 0 && topOff > 0){
$('#one').offset({
top: topOff--
});
}
}
intervalId = setInterval(move, speed);
$('#one').click(function(event){
if(amount === 10){
clearInterval(intervalId);
$('#one').text('Вы выиграли');
return;
}else{
speed -= 10;
amount++;
clearInterval(intervalId);
intervalId = setInterval(move, speed);
$('#one').text(amount);
}
});