:href="id + '/' + results.id"
var convertToCurrency = function(val) {
var trim = val.replace(/\s/g, '');
var parsed = parseInt(trim, 10);
var converted = parsed.toLocaleString('ru') + '₽';
return converted;
}
var inp_1 = $('#inp_1');
inp_1.val(convertToCurrency(inp_1.val()));
inp_1.on('change', function() {
inp_1.val(convertToCurrency(inp_1.val()));
});
//хук mounted
mounted() {
this.$store.dispatch('sities/fetchSities', {queryParams}).then(res => {
Vue.set(self, 'cities', this.$store.state.sities.cities);
});
}
//state
cities: []
//mutations
set_sities(state, payload) {
state.cities = payload;
}
//actions...
fetchSities(context, params) {
return new Promise((resolve, reject) => {
callApi('towns', params).then(res => {
context.commit('set_sities', res.data.data);
resolve(res); //!
}).catch(error => reject);
});
}
//где нибудь
var params = { ... };
this.$store.dispatch('fetchSities', params).then(res => {
console.log(res); //ответ от api
console.log(this.$store.state.cities); //массив с данными
});
<link rel="stylesheet" id="et-builder-googlefonts-css" href="https://fonts.googleapis.com/css?family=Oswald:200,300,regular,500,600,700&subset=cyrillic,vietnamese,latin,latin-ext" type="text/css" media="all">