vuex

The Mix manifest does not exist

眉间皱痕 提交于 2019-12-11 06:42:43
问题 i'm created simple laravel project with this Laravel-Vue SPA starter project template and im uploaded this project to ubuntu server. all settings corect but i run this project returns this error "The Mix manifest does not exist. (View: /var/www/html/project/resources/views/index.blade.php)". please anyone help me. i'm new in laravel. 回答1: I think it's because of that you separated your laravel files from public folder. and public_path() returns wrong path. for being sure try dd(public_path())

How to stop Vue life cycle from moving on before Vuex actions have completed?

耗尽温柔 提交于 2019-12-11 05:55:33
问题 In my application, I want to initialize 3 Vuex modules before the rest of the application starts. However, no matter what I try, the code in the Vue instance life cycle hook in which I perform the initialize, moves on before the 3 modules have completed their initialization. I have added a promise around the code in the Vuex actions that do the initializing, so that I can (a)wait on those in the calling life cycle hook, but it doesn't work. I have looked at sample Vuex code that uses Axios,

How can I call a method after the loops(more than 1 loop) complete on vue js?

梦想的初衷 提交于 2019-12-11 05:47:16
问题 My vue component like this : <template> <div class="row"> <div class="col-md-3" v-for="item1 in items1"> ... </div> <div class="col-md-3" v-for="item2 in items2"> ... </div> <div class="col-md-3" v-for="item3 in items3"> ... </div> </div> </template> <script> export default { ... computed: { items1() { const n = ... // this is object return n }, items2() { const n = ... // this is object return n }, items3() { const n = ... // this is object return n } }, ... } </script> If the three loop

How to set dynamic object values with Vue/Vuex?

孤街醉人 提交于 2019-12-11 05:32:13
问题 I'm struggling to understand how to dynamically create & populate a key: value pairs in an object in my state using Vue/Vuex, here's an example: dataObject: {} (in state), and a mutation that creates the new key:value pairs: setdataObjectProps: (state, payload) => { for (let [key, value] of Object.entries( state.dataObject )) { if (key == payload[0]) { dataObject.total_operation_time = payload[1]; dataObject.machine_name = payload[2]; } } }, This solution works, but the key:value pairs should

Axios post request with multiple parameters in vuex action

时光总嘲笑我的痴心妄想 提交于 2019-12-11 04:13:17
问题 Fetching API data with axios in vuex action: actions: { login ({commit}, payload) { axios.post(globalConfig.TOKEN_URL, { payload }) .then((resp) => { commit('auth_success', resp.data) }) .catch((err) => { console.log(err) }) }, } Component's method for sending the data: methods: { authChatClient () { let payload = { name: this.clientFio, number: this.clientNumber } this.$store.dispatch('login', payload) }, } However it won't work, since payload is an object, wrapped in a payload object. Is it

Can't send in a second parameter to the mutation in Vue store

人盡茶涼 提交于 2019-12-11 03:37:26
问题 I have a nice mutation JS file like this. export default { UPDATE_DATA: (state, data, meta) => { state.dataTable = data; if (meta === undefined) return; state.activeDataRow = meta; }, ... } It's being called by to different actions in the following ways. context.commit("UPDATE_DATA", Map.table(payload.type, data)); context.commit("UPDATE_DATA", Map.table(payload.type, data), meta); I've checked the meta being sent in the action and it's definitely not undefined . However, when I check the

How to have all the static strings in one place

只愿长相守 提交于 2019-12-11 03:08:48
问题 I am creating a vue webapp, I have few pages with Dynamic content and also few pages which has mostly static content. I want to move all these static strings to one place. One option can be to use vue-i18n or vue-multilanguage, these gives support to have content files like this, but I really have no use case of support of multiple languages, so it also seems a bit over kill to me. Another option can be to have a vuex store for all the strings, vuex I am already using for state management.

Vue and Vuex: Handling dependent computed properties

六眼飞鱼酱① 提交于 2019-12-11 03:01:05
问题 My application is a cut-down spreadsheet built in Vue with Vuex. The key components are TableCollection , Table and Row . The TableCollection has an array with multiple Table objects. Each Table has an array with multiple Row objects. The Row component has a property named calculatedField . This simply combines two fields in the row to produce a third field. My options are to implement calculatedField as a computed property, local to the Row component, or as a getter in the Vuex store. The

vuex的使用——详述

两盒软妹~` 提交于 2019-12-11 01:39:47
vuex的使用—详述 一、什么时候使用vuex 二、vuex的使用 三、vuex中 store 的固定内容 (1)**state:保存状态的** (2)**mutaions 方法** (3) getters的基本使用 (4) actions (5) modules 四、vuex 的目录结构 五、版权声明: 本文纯原创,谢绝copy,如想转载,请提前留言告知,经本人允许后方可转载,违者必究! 不足 一、什么时候使用vuex 在多个页面得共享问题,比如:用户的登录状态,用户名、头像、位置信息,再比如商品的收藏、购物车中的物品等。 二、vuex的使用 我们首先需要下载依赖,并且做一些准备工作: npm install --save vuex 创建仓库 store 就是 创建一个名字叫 store 的文件夹 在仓库中创建 index.js (如果你使用的是ts,需要创建ts文件); 在index.js中引入vue/vuex; import Vue from 'vue' import Vuex from 'vuex' 安装插件 Vue.use(Vuex) 创建对象; const store = new Vuex.Store({ }) 导出store对象; export default store 在main.js中引入store文件 并挂载在 实例上 三、vuex中 store 的固定内容

如何在 vue 中封装 axios

大城市里の小女人 提交于 2019-12-11 00:57:52
目录结构: // http.js import axios from 'axios' import qs from 'qs' // 引入qs模块,用来序列化post类型的数据 import { Message } from 'element-ui' import router from '../router' import store from '../store/index' // 根据环境切换 baseURL axios . defaults . baseURL = process . env . BASE_URL // 设置请求超时 axios . defaults . timeout = 10000 // post 默认请求头设置 axios . defaults . headers . post [ 'Content-Type' ] = 'application/x-www-form-urlencoded;charset=UTF-8' // 请求拦截 axios . interceptors . request . use ( config => { // 从 store 中获取 token 并添加到请求头,后台根据 token 判断你的登录情况 const token = store . getters . userInfo . token token && (