Vue/Vuex unknown action type

Try this: import { mapGetters, mapActions} from ‘vuex’ computed: { …mapGetters({ companies: ‘company/allCompanies’ }) } methods: { …mapActions([‘company/getCompanies’, ‘company/getEmployees’]) }, mounted() { this[‘company/getCompanies’](); }, But, I like to do namespacing as done below, but it has an issue, refer the issue here. methods: { …mapActions(‘company’, [‘getCompanies’, ‘getEmployees’]) }, mounted() { this.getCompanies(); this.getEmployees(); },

How to get vuex state from a javascript file (instead of a vue component)

It is possible to access the store as an object in an external js file, I have also added a test to demonstrate the changes in the state. here is the external js file: import { store } from ‘../store/store’ export function getAuth () { return store.state.authorization.AUTH_STATE } The state module: import * as NameSpace … Read more

How to include a CDN to VueJS CLI without NPM or Webpack?

Unfortunately, no, you can’t add a <script> tag to a specific component via template. In your case you have some options: 1: Use NPM Propertly install the dependency using npm Pros: proper usage of NPM and Webpack; scoped definition; Cons: the script must be available as a NPM package. Note: when available this is the … Read more

How to submit a form in Vue, redirect to a new route and pass the parameters?

The default behavior of <form> is to reload the page onsubmit. When implementing SPA’s it would be better to avoid invoking default behavior of <form>. Making use of router module which is available out-of-box in nuxtjs will enable all the redirection controls to flow within the application. if we try to trigger events available via … Read more

How to call function from watch?

If you want to use watch to observe your property, you could call your method it with this.foo: data: function () { return { questions: [] } }, watch: { questions: { handler: function(val, oldVal) { this.foo(); // call it in the context of your component object }, deep: true } }, methods: { foo() … Read more

How to use vue.js with Nginx?

Add the following code to your Nginx Config, as detailed in the VueRouter docs, here: location / { try_files $uri $uri/ /index.html; } Also, you need to enable history mode on VueRouter: const router = new VueRouter({ mode: ‘history’, routes: […] })

Vue v-if statement to check if variable is empty or null

If you want to show the <div> only when it is truthy (not empty/null/etc.), you can simply do: <div v-if=”archiveNote”> This gives the same result as the double bang: <div v-if=”!!archiveNote”> Both of these expressions evaluate all 8 of JavaScript’s falsy values to false: false null undefined 0 -0 NaN ” 0n (BigInt) and everything … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)