Skip to content
Advertisement

Tag: vue.js

How to use function that return value inside a template? Vuex, Vue

I’m using a template to get data of a json file, I use “v-for” to print all data, for example: But I need use functions, year() to modificate this information and return and result, for example: The value {{ item.date }} print “2021-01-20” but I hope print “2021” using the function {{ year(item.date) }} Code function year() using javascript: I

ECONNREFUSED when dispatch action in nuxtServerInit

I am converting my Nuxt application to SSR – because I want to use nuxtServerInit and asyncData. These are the steps I have taken to convert it. Remove ssr: false from nuxt.config.js Dispatch actions to initialize store’s state in nuxtServerInit inside store/index.js Now my nuxt.config.js looks like this And the store/index.js looks like this. But after I restarted the development

VueJS – call function in external JS file directly from Template

Let’s say that in a VueJS project, I have a HelloWorld.js file like this: And it’s used from HelloWorld.vue like this: My agony comes from having to ‘duplicate’ the addNumbers function in the methods section of the HelloWorld component. Is there a simple way to make the external addNumbers function available from the template section? Answer you could export as

limited number of dynamic generated images by using vue

I wanted to make a div of random positioned icons and this is what i made so far. Can we make this to generate only limited number of images like 20 images and not unlimited. If you have better way to make something like this, then i would be really thankful. Thanks Answer Introduce variables for the total, the current

How to use a method on page load? VueX

I’m learning Vue with Vuex, I made a method called ‘llamarJson’this method get a json data. I don’t know how to use it when the page load. I tried many ways but I could not find a solution. I’m using Vue and Vuex. Please, could you help me? That’s the code html: That’s the JS code: Answer you should use

did you register the component correctly? For recursive components, make sure to provide the “name” option. (found in ) VUE

I’m learning Vue with Vuex, I tried to do a component but appear this error: vue.js:634 [Vue warn]: Unknown custom element: actividadescomponent – did you register the component correctly? For recursive components, make sure to provide the “name” option. (found in ) error screen shot I tried many ways but I could not find a solution. That’s the code html:

Vue add new value to array

I am new to VUE and for one project I am trying to update an array passing the object. I have two button which is called BUTTON 1 and BUTTON 2. If you click on BUTTON 1 then it will set an object to list[] using this.$set. But when BUTTON 2 is pressed it should update with the new value

Advertisement