<div v-for="n in 11">{{ n + 29 }}</div>
<div v-for="n in 40" v-if="n >= 30">{{ n }}</div>
<div v-for="n in values">{{ n }}</div>
values: [ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 ],
<div v-for="n in getValues(30, 40)">{{ n }}</div>
getValues(lower, upper) {
return [...Array(upper - lower + 1)].map((n, i) => lower + i);
},
...это делается за пределами компонента. Плюс надо добавить selected для каждой карточки. Их может быть много. Нужно как то событиями реализовать.
<vue-select
:value="selected.id === item.id ? selected.option : null"
:options="item.versions"
@input="selected = { id: item.id, option: $event }"
></vue-select>
Владивосток - плюс 7 часов к текущему.
function getTimeInTimezone(zone) {
const
d = new Date(),
utc = d.getTime() + d.getTimezoneOffset() * 60000;
return new Date(utc + zone * 3600000);
}
new Date()
, делаем так: getTimeInTimezone(10)
. const request = require('request');
request.get({
url: 'https://toster.ru/q/461924',
proxy: 'http://195.209.176.2:8080'
}, (err, res) => {
if (err) {
console.log('ERROR', err);
} else {
console.log('OK', res);
}
});
exports.findOrCreate = function findOrCreate(userID, provider){
return new Promise(function(resolve, reject) {
client.getAsync('accounts:' + provider + ':' + userID).then((accountID) => {
if (accountID !== null) {
client.hgetallAsync('account:' + accountID).then(resolve, reject);
} else {
reject();
}
}, reject);
});
};
if (![ 'search', 'search_input', 'cancel_btn' ].includes(target.className)) {
const t = target.className;
if (t !== 'search' && t !== 'search_input' && t !== 'cancel_btn') {
if (!target.matches('.search, .search_input, .cancel_btn')) {
<div class="block">hello, world!!</div>
<div class="block">fuck the world</div>
<div class="block">fuck everything</div>
.block {
display: inline-block;
width: 500px;
height: 150px;
padding: 20px;
background: red;
color: white;
}
const $blocks = $('.block').hide();
let i = -1;
(function showNext() {
$blocks
.eq(i = (i + 1) % $blocks.length)
.dequeue()
.fadeIn(1000)
.delay(500)
.fadeOut(1000)
.queue(showNext);
})();
|о|д|и|н|
|е|т|ы|д|
|ч|е|р|в|
|и|р|т|а|
function makeTable(data) {
data = data.join('').split('');
let width = Math.sqrt(data.length) | 0;
let height = (data.length / width) | 0;
while (width * height !== data.length) {
width--;
height = (data.length / width) | 0;
}
const position = [ 0, 0 ];
const directions = [
[ 1, 0 ],
[ 0, 1 ],
[ -1, 0 ],
[ 0, -1 ],
];
let direction = 0;
const result = Array.from({ length: height }, n => Array(width).fill(null));
for (const n of data) {
result[position[1]][position[0]] = n;
if (null !== (result[position[1] + directions[direction][1]] || {})[position[0] + directions[direction][0]]) {
direction = (direction + 1) % directions.length;
}
position[0] += directions[direction][0];
position[1] += directions[direction][1];
}
return result.map(n => n.join(' ')).join('\n');
}
console.log(makeTable([ 'раз', 'два', 'три' ])); /*
р а з
р и д
т а в
*/
console.log(makeTable([ 'один', 'два', 'три', 'четыре' ])); /*
о д и н
е т ы д
ч е р в
и р т а
*/
console.log(makeTable([ 'hello', ',', ' ', 'world', '!!' ])); /*
h e
! l
! l
d o
l ,
r
o w
*/