Tagged Questions
0
votes
2answers
26 views
Check if it's possible to go forward when using vue-router
I'm developing an application using Vue2 and Vue-router (version ^2.2.0) and the back and forward navigation buttons have to show if the user can go back/forward or not.
To check if the user can go ...
0
votes
1answer
25 views
Why onclick event doesn't work with vue-router?
i want to use vue.js with vue-router, but..
in App.vue:
<template>
<div id="app">
<hello></hello>
<router-view></router-view>
</div>
</...
4
votes
1answer
27 views
Vue 2 Laravel 5.3 Eloquent unable to retrieve data from object
Vue2 has been reading eloquent pretty well so far for me but except this point where I struggle to debug.
Shop-show.vue
<template>
.....
.....
<div class="row">
{{shop.user.id}}...
0
votes
1answer
38 views
Vue 2 component re-render after switching dynamic component inside it
I have a main component that import two other components:
admin page
login page
in the main component I have:
<template>
<div id="app">
<component v-bind:is="currentView">&...
1
vote
2answers
49 views
How to test computed properties in Vue.js? Can't mock “data”
I wonder how to test computed properties in Vue.js's unit tests.
I have create a new project via vue-cli (webpack based).
For example here are my Component:
<script>
export default {
...
0
votes
0answers
14 views
Vue2: How is reuse existing directive in my custom directive?
Code for my custom directive:
Vue.directive('position', {
// When the bound element is inserted into the DOM...
inserted: function (el) {
// exist directive v-sors
}})
2
votes
1answer
30 views
Vue2 error when trying to splice last element of object
I have a Vue2 app wit a list of items which I can choose and show, or delete.
When deleting the last element in the list (and only the last one) - I get Vue warn - "[Vue warn]: Error when rendering ...
1
vote
1answer
29 views
Vue 2 Laravel 5.3 Infinte Update Loop
There is no console log error but anything that I put in updated() hook [in the current code getCartItems/] will be rendered infinitely for some reasons that I do not know. even I set it as alert('hi')...
2
votes
0answers
65 views
Odd output for console.log between node.js and chrome browser
I'm playing with node's crypt() and just wanted visual confirmation that the Diffie-Hillman shared secret between node ('Alice') and the Chrome client ('Bob') was matching up. I send the public keys ...
0
votes
1answer
42 views
Vue 2 Laravel 5.3 Vue-router 2 Proper way to set up Vue-router
Just want to set up a simple redirection upon click on something. Not sure how to use vue-router to do such. Please find my codes below:
app.js
import VueRouter from 'vue-router';
Vue.use(VueRouter)...
0
votes
1answer
46 views
Forcing Vue component to re-render
So this must sound a bit strange, but I made a Vue application that acts as a documentation for our main application built in angular. One of the things I want the documentation to do is display some ...
0
votes
1answer
31 views
Vue 2.0 Larave. 5.3 Nesting component in a component
how can I properly use another component within a component? it shows warning of syntax error after I adding both
import Item-card from './components/Item-card.vue';
and
components::{
'item-card':...
0
votes
2answers
117 views
Vue 1.x/2.x: Get vue-router path url from a $route object
As we know, we can use vue-route to wrap some route paths.
<!-- vue 1.x -->
<a v-link="{name: 'route_name', params: {id: 1}}"></a>
And in vue2:
<!-- vue 2.x -->
<router-...
1
vote
1answer
210 views
Vue.js what's the difference of $emit and $dispatch?
In vue2.0 the event $dispatch and $broadcast is deprecated.
And I found that $dispatch is similar with $emit.
What's the differences between them? Is it safe directly replacing $dispatch into $emit ...
1
vote
3answers
119 views
Vue.js 2: How to initialize(construct) a Vue component from a .vue file?
I'm trying to create a Component instance:
App.vue
import MyComponent from './components/MyCompnent.vue';
export default {
mounted() {
// The following line fails.
const vm = new ...
0
votes
1answer
77 views
In vue2 v-for nested component props aren't updated after element is removed in parent
For my app I'm using two Vue components. One that renders a list of "days" and one that renders for each "day" the list of "locations". So for example "day 1" can have the locations "Berlin", "London",...
0
votes
0answers
45 views
-enter-active and -leave-active classes doesn't appear while toggle-in Vue event
For some reason it is impossible to make transition effect where the -enter-active and -leave-active appears with a default timeout in de html code of my webpack/vue-loader application.
I've copy/...
2
votes
1answer
224 views
How to get route params to work with vue-router and vuex
I'm trying to pass data from a component to $route.params.post but somewhere along the line it's failing and I'm not sure how to get it to work.
In my component I'm using router-link to go to a ...
0
votes
1answer
33 views
What is the proper way to mutate values from an imported sibling component in Vue.js 2.0?
I'm using the single-file component approach with Vue 2.0. I have 3 components App (parent), AppHeader, and FormModal. AppHeader and FormModal are immediate children of App and siblings of each other.
...
1
vote
1answer
100 views
Using Vue-Resource in Vuex store; getting maximum call stack size error
I'm trying to pull an array from my api to a component using vuex but I'm at a loss and probably in over my head in attempting this. With the api being accessed directly from a component I had it set ...
0
votes
0answers
56 views
Proper way to override properties and methods in Vue.js?
What is the proper way to override methods using mixins in Vue.js? I know that you're able to mock inheritance using mixins, but let's say that you want to extend some props but not completely ...
1
vote
2answers
130 views
Dynamically adding elements in vue.js
tl;dr: I am generating a table with editable cells similar to the one pictured below. I have it so the cells are editable and the total updates, but I am struggling to figure out the process I need ...
0
votes
1answer
50 views
vue.js 2 Reusing component with two different parent variables
Im trying to use a component which changes the years of experience with a programming language. ir order to do so i use a couple of buttons to add and subtract the years, and a 'tech' prop to pass the ...
2
votes
3answers
201 views
Dynamically inject Vue 2 component from shortcode
I have a form in an admin area where users can input text with shortcodes in them:
Heat oven at [temp c=200]
What I want is that temp shortcode to be parsed and transformed into a Vue 2 component ...
2
votes
1answer
219 views
Best Practice for Reacting to Params Changes with Vue Router
When using Vue Router with routes like /foo/:val you have to add a watcher to react for parameter changes. That results in somewhat annoying duplicate code in all views that have parameters in the URL....
0
votes
2answers
430 views
vue 2.0 and vue-router 2.0 build SPA, router-view did not update
Build A Single page app with vue 2 and vue-router 2 and vuex 2, but do not update
/src/main.js
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './...
2
votes
1answer
387 views
Vue-router 2 changes route but does not update the view?
I have a login issue with website that uses:
Vue.js v2.0.3
vue-router v2.0.1
vuex v0.8.2
In routes.js I have a simple interceptor setup
router.beforeEach((to, from, next) => {
if (to.matched....
4
votes
0answers
426 views
Vue.js 2.0 Module build failed: SyntaxError: Unexpected token using webpack, Elixir and gulp
After spending almost complete day trying to upgrade from Vue.js 1.X to Vue.js 2.0 I'm still getting errors (using gulp watch)
ERROR in
./~/buble-loader!./~/vue-loader/lib/selector.js?type=script&...
0
votes
2answers
321 views
Vue.js 2.0 - creating reusable components
I am trying to create fully reusable component using Vue.js 2 and single file components, and right now my approach seems to be impossible to realize.
The goal is to create component for creating ...
0
votes
1answer
261 views
Vue 2 - Communication between components (sending and receiving data)
So I working on app in Vue. I have problem with sending and receiving data between components. Already tried with $dispatch/$broadcast, $emit/$on but still now working. I want to send selected ...
0
votes
0answers
42 views
trigger submit manually not working as expected when form have custom directive
I have a global directive named ajax-submit that have a eventlistener in the bind for when the element submit, this working fine, the problem is when i trigger manullay the submit event via ...
0
votes
2answers
218 views
How to render filter of a nested element in Vue 2?
I had the following in Vue 1.x
<tr v-for="product in products">
<td><img src="{{ product.image_url | thumbnail }}" class="thumbnail"></td>
</tr>
But in Vue 2 I tried:...
0
votes
1answer
227 views
How does validation work in Vue.js 2.0?
New to Vue.js. I googled and found a lot of resources for Vue.js 1.0 but not for vue js 2.0.
4
votes
2answers
505 views
How to get Flow to properly work with Vue 2 (webpack)?
I'm trying to add Flow to the Vue 2 webpack-template. For the record, I'm on runtime-only (files follow the .vue format / standard).
My first attempt was to use flow through the cli, which I realized ...
1
vote
1answer
395 views
Changing Vue.js from standalone to runtime-only build later in a project?
Went with the runtime-only build version of Vue.js for a new project. I saw in the docs that to switch to the standalone one needs to add an alias to webpack, like so:
resolve: {
alias: {
'vue$'...
0
votes
2answers
98 views
Vue transition mode on on-demand components not working
I have a SPA which has multiple pages. The pages are components and are loaded on-demand using web pack's code splitting.
The pages are wrapped with <transition mode="out-in"> tag, however, ...
1
vote
1answer
170 views
Component Vuejs2 declare $data obj to share data between components
I am trying to make a Vue2 component to all the select of my app so would be easier later to change it if necessary!
I've based my research on the example given by the docs and I am breaking my head ...
0
votes
1answer
152 views
How to trigger a transition when a component is reused?
How to trigger a transition when transitioning between the same component?
(With vue-router 1, there was a canReuse hook. It doesn't exist anymore in vue-router 2.)
const Index = {
template: ...
0
votes
1answer
3k views
Failed to mount component: template or render function not defined
I'm trying to use vue-router to display routed components below my navbar component but I get an error specified in the title.
Here is my code:
main.js
import Vue from 'vue';
import VueRouter from ...
1
vote
2answers
3k views
Vue 2 - Mutating props vue-warn
So, i back to programing after one year, and i see lots of changes ;) Eg. Using Laravel as api, and big JS frameworks as frontend is normal thing, not "adavnced case".
I thinking about learn React ...
0
votes
1answer
385 views
Sortable.js with Vue 2.0 sorts incorrectly
I am using Sortable.js and Vue.js. The goal is to sort items and keep data updated.
It worked well with Vue 1.x, but after update to 2.0 sorting became incorrect. Array still properly updates, but ...
1
vote
2answers
834 views
Bootstraping with vue 2, router and vue-loader
With vuejs 1 the code was:
const App = Vue.extend(Index);
router.start(App, '#app');
Where Index is a component.
I try to convert it to vue 2 like this:
const App = Vue.extend(Index);
const app ...
2
votes
1answer
172 views
Vue 2.x computed property is not updated when its dependencies are binded with inline data
I face the following problem trying to migrate from Vue 1.0.27 to Vue 2.0.1.
EDIT added working JSFidle
The situation:
I have built a very simple app that takes a list of tasks (from the model) ...
0
votes
1answer
89 views
On Vue2.0 I should be how to compile the template and binding template events
I have the following component,How can I dynamically compile rowTemplate and cellTemplate, and bind dynamically added events on templates?
In the following code, only the output of the original html.
...
2
votes
1answer
300 views
Showing loading spinner for async Vue 2 components
I have a fairly heavy component which I would like to load asynchronously, while at the same time showing the user a loading spinner when it's loading.
This is my first attempt, using loading ...
3
votes
1answer
1k views
Vue: How to use store with component?
//store
export default {
state: {
aboutModels: []
},
actions: {
findBy: ({commit}, about)=> {
//do getModels
var aboutModels = [{name: 'About'}] //Vue.resource('/abouts')....
2
votes
2answers
3k views
Vue JS 2.0 not rendering anything?
Using Vue (^2.0.0-rc.6) + Browserify, entry point is index.js:
import Vue from 'vue'
import App from './containers/App.vue'
new Vue({ // eslint-disable-line no-new
el: '#root',
render: (h) => ...
2
votes
1answer
487 views
Vue 2.0 instance is not hearing events emitted by vue-router components
I am using Vue 2.0-rc.6 (latest at the moment) and Vue-router 2.0-rc.5 (latest at the moment).
I tried to do this.$emit('custom-event') in one of my router components, and this.$on('custom-event', () ...
2
votes
1answer
205 views
Toggle a CSS class in Vue 2.0
In vue 1 I was doing this: v-bind:class='{"isdanger": invalidLogin}'.
Now I'm trying to do the same in a Vue 2 app but I'm getting this error:
template syntax error - invalid expression: v-bind:...
1
vote
1answer
131 views
vue-route pass different props to different view component when router changed in vuejs2.0?
In this ticket, we can pass parameters to component when the route changes via
<router-view class="view" :propForA="AData"></router-view>
My question is If we need pass different props ...