@click="openModal(message)"data: () => ({
openedMessage: {},
...
}),
methods: {
openModal(message) {
this.openedMessage = message;
this.showMessageModal = true;
},
...
},<span class="box-title">{{ openedMessage.какоеТамУВасСвойствоОтвечаетЗаЭтотTitle }}</span>
...
<div class="box-body">{{ openedMessage.нуТутТожеВамВиднееЧтоНаписать }}</div>
Vue cannot detect the following changes to an array <...> When you directly set an item with the index
this.terain[x][y] = Number(this.cursorBlock)this.$set(this.terain[x], y, +this.cursorBlock);
// или
this.terain[x].splice(y, 1, this.cursorBlock | 0);
const $test = $('.test').on('click', '.testText', function() {
$test.append($(this).clone());
});$('.testText').click(function() {
$('.test').append($(this).clone(true));
});
this.$store.dispatch({type:'ADD_CONTACT'}, payload)
actions:{ addContact:
this.$store.dispatch({
type: 'addContact',
payload,
});actions: {
addContact: ({ commit }, { payload }) => commit('ADD_CONTACT', payload),
},this.$store.commit('ADD_CONTACT', payload).
Код компонента где хранятся все посты:
@click="addPostToHistoryComp(post.id, post.title, post.body)"
paginatedData() { const start = this.page * 6;
addPostToHistoryComp(val){ this.$store.dispatch('transforPostToHistoryComp', { pTitle: val.post.title,
<li v-for="(historyPost, index) in historyPosts" class="post" :key="index"> <img src="src/assets/nature.jpg"> <p class="boldText"> {{ post.title }}</p>
const todohistory = { title: payload.pTitle, body: payload.pBody, id: payload.pId } commit('ADD_TODO_HISTORY', todo)
ADD_TODO_HISTORY (state, todohistoryObject) { state.historyPosts.unshift(todoObject) },
data-country почему-то на русском - какого чёрта? Надо, чтобы были такими же, как и id у элементов .tabcontent.const tabLinks = document.querySelectorAll('.tablinks');
const tabContent = document.querySelectorAll('.tabcontent');
tabLinks.forEach(n => n.addEventListener('click', openTab));
function openTab({ currentTarget: t }) {
const { country } = t.dataset;
tabLinks.forEach(n => n.classList.toggle('active', n === t));
tabContent.forEach(n => n.classList.toggle('active', n.id === country));
// или, к чёрту data-атрибуты и id, можно индексами воспользоваться;
// конечно, в этом случае необходимо, чтобы .tablinks и соответствующие им
// .tabcontent были расположены в одинаковом порядке
const index = Array.prototype.indexOf.call(tabLinks, t);
tabLinks.forEach(n => n.classList.toggle('active', n === t));
tabContent.forEach((n, i) => n.classList.toggle('active', i === index));
}
placemark.events.add('click', () => {
// здесь дёргаете scrollTo или scrollIntoView
});
<button v-for="(n, i) in items" @click="onClick(i)">{{ n }}</button>methods: {
onClick(index) {
this.items = this.items.slice(0, index + 1);
// или
// this.items.splice(index + 1, this.items.length - index);
},
...
},
const info = new google.maps.InfoWindow();marker.addListener('click', function() {
info.setContent('сюда засовываете свою информацию');
info.open(map, marker);
});
$('p i').text((i, text) => i % 3 ? text : 'hello, world!!');document.querySelectorAll('p i').forEach((n, i) => {
n.textContent = i % 3 ? n.textContent : 'fuck the world';
});p общий родитель, то можно и не смотреть на индекс, сразу нужные элементы получить:for (const n of document.querySelectorAll('p:nth-of-type(3n + 1) i')) {
n.innerText = 'fuck everything';
}
if (inputs[el].value == "") el++; if (inputs[el].value.match(/[А-я]/)) {