Posts

Showing posts with the label vuejs2

VueJS Computed Data Search Not Functioning

VueJS Computed Data Search Not Functioning I am attempting to create a search function in my Vue.js 2 application. However, even though my algorithm is giving me the right results, I am not getting the proper filter. Right now, whenever I run a search, I get nothing on the page. Here is my code: computed:{ filteredSmoothies: function(){ return this.smoothies.filter(smoothie => { var stuff = smoothie.title.split(" ").concat(smoothie.description.split(" ")).concat(smoothie.category) var sorted = ; for (var i = 0; i < stuff.length; i++) { sorted.push(stuff[i].toLowerCase()); } console.log(sorted) if(this.search != null){ var indivthings = this.search.split(" ") indivthings.forEach(item => { if(sorted.includes(item.toLowerCase())){console.log("true")} else {console.log("false")} if(sorted.includes(item.toLowerCase())){return true} }) } else { return true ...

How to get token asp.net mvc 5 equal vuejs ( login use jwt in vue )

How to get token asp.net mvc 5 equal vuejs ( login use jwt in vue ) How can I get token asp.net mvc 5 equal vuejs ( login use jwt in vue )? back-end i use asp.net mvc5 and front-end i use vuejs2, problem is i'm not understand it login, how? how to use login with jwt ? This question is liable to be put on hold since it is of very poor quality and you provided little code evidence. – Oighea Jun 30 at 2:50 By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

How get component instance from unnamed slots on Vue.js2

How get component instance from unnamed slots on Vue.js2 I have next template: <TableComponent> <TableColumn v-bind:field="'firstName'" v-bind:label="'First Name"> </TableColumn> How i can get component instances of TableColumn ? TableColumn On TableComponent I have next mounted method: mounted mounted () { const columnComponents = this.$slots.default .filter(column => column.componentInstance) .map(column => column.componentInstance) console.info(columnComponents) }, But on console info I got empty array. How I can get TableColumn props? TableColumn 1 Answer 1 Use a ref ref <TableComponent> <TableColumn ref="tableColumn" v-bind:field="'firstName'" v-bind:label="'First Name"> </TableColumn> and then mounted() { this.$nextTick(() => { const col =...

vue js:routes not found when page reloads

vue js:routes not found when page reloads Here is simple vue-routing const Foo = { template: ' foo ' } const Bar = { template: ' bar ' } const routes = [ { path: '/foo', component: Foo }, { path: '/bar', component: Bar } ]; const router = new VueRouter({ routes:routes, mode: 'history' }); var app = new Vue({ router, data: { message: 'Hello Vue!' }, mounted:function(){ } }).$mount('#app'); In HTML <router-link to="/foo">Go to Foo</router-link> <router-link to="/bar">Go to Bar</router-link> <router-view></router-view> The links loaded properly (ie : /foo and /bar ) when i click on it but if i refresh any vue routed url (ie /foo or /bar ) url i will get error message /foo /bar /foo /bar cannot get the page I am serving it with simple express server app.get('/', (req, res) => res.sendFile('index.html',{ r...