TypeError: val.replace is not a function
". Параметр min_price точно строка <div class="price">от<span v-html="sup(good.min_price)"></span><span class="rub">С</span></div>
. То вообще никакие данные не отображаются, а массив данные видно что пустой. Если не применяю метод, то все данные отображаются items2: [ {a: 'AAA'}, {b: '9.99'}, {c: '0'} ]
и код <p v-html="sup(item.b)"></p>
не работает(( Как это можно поправить? currentOffset += lim;
step ++;
callApi ('products', queryParams, '').then((data) => {
currentOffset += lim;
step ++;
if (data.data.data.length) {
this.goods = this.goods.concat(data.data.data);
$state.loaded();
$('#preview-buttons button').hide();
} else {
$('#preview-buttons button').show();
}
export const state = () => ({
products: []
})
export const actions = {
fetchProducts (state, {queryParams}) {
callApi ('products/', queryParams, '').then((res) => {
state.commit('setProducts', res.data.data)
})
}
}
export const mutations = {
setProducts: (state, data) => {
state.products = state.products.concat(data)
// state.good = Object.assign({}, data)
}
}
export const state = () => ({
products: []
})
export const actions = {
fetchProducts (state, {queryParams}) {
callApi ('products/', queryParams, '').then((res) => {
state.commit('setProducts', res.data.data)
})
}
}
export const mutations = {
setProducts: (state, data) => {
state.products = state.products.concat(data)
// state.good = Object.assign({}, data)
}
}
this.$store.dispatch('brends/fetchDataBrends', {queryParams}).then(res => {
var countItem = this.$store.state.brends.dataBrends;
this.numberOfPage = Math.ceil(countItem / lim);
});
this.$store.dispatch('sities/fetchSities', {queryParams}).then(res => {
Vue.set(self, 'cities', this.$store.state.sities.cities);
});
Uncaught TypeError: Cannot read property 'dispatch' of undefined
//store/sities
import Axios from 'axios'
import callApi from '~/libraries/api.js'
export const state = () => ({
cities: [],
})
export const actions = {
fetchSities (state, {queryParams}) {
return new Promise((resolve, reject) => {
callApi('towns', params).then(res => {
context.commit('setSities', res.data.data);
resolve(res); //!
}).catch(error => reject);
})
},
}
export const mutations = {
setSities: (state, data) => {
state.cities = Object.assign({}, data)
},
}
//внутри компонента
computed: {
cities () { return this.$store.state.sities.cities },
},
this.$store.dispatch('sities/fetchSities', {queryParams}).then(res => {
Vue.set(self, 'cities', this.$store.state.sities.cities);
});
Vue.set(self, 'cities', res.data.data)
export const actions = {
fetchSities (state, {queryParams}) {
callApi ('towns', queryParams,'').then((res) => {
state.commit('setSities', Vue.set(self, 'cities', res.data.data))
})
},
}
import Axios from 'axios'
import callApi from '~/libraries/api.js'
export const state = () => ({
brends: [],
})
export const actions = {
fetchBrends (state, {queryParams}) {
callApi ('brends', queryParams,'').then((res) => {
state.commit('setBrends', res.data.data)
})
}
}
export const mutations = {
setBrends: (state, data) => {
state.brends = Object.assign({}, data)
},
}