vue-router

Vue-Router Passing Data with Props

和自甴很熟 提交于 2019-12-20 09:56:17
问题 I am having a hard time passing props using Vue-Router. I seem to not be able to access the props when I bring them into the next view. This is my methods object: methods: { submitForm() { let self = this; axios({ method: 'post', url: url_here, data:{ email: this.email, password: this.password }, headers: { 'Content-type': 'application/x-www-form-urlencoded; charset=utf-8' } }).then(function(response) { self.userInfo = response.data; self.$router.push({name: 'reading-comprehension', props:

[Vue全家桶]vuex、vue-router、 axios源码全解析

本小妞迷上赌 提交于 2019-12-20 03:27:56
今日推荐 源码系列 vuex源码全解析 https://mp.weixin.qq.com/s/hY2K35L11vLc0-OvUTTg0A vue-router源码全解析 https://mp.weixin.qq.com/s/5-tRCJTd3K65PZSLrwVCfw axios源码全解析 https://mp.weixin.qq.com/s/GNYpgHo97xml0NxT93dHxQ 来源: CSDN 作者: iChangebaobao 链接: https://blog.csdn.net/iChangebaobao/article/details/103617770

Vue webpack is adding #/ to all URLs

前提是你 提交于 2019-12-20 02:04:31
问题 I am following along with some Vue projects using vue init webpack test , but it seems like when running npm run dev , there is always a #/ appended to all urls. This is also true for when I create a new component and route to it. If i do something like http://localhost:8080/newpath , it becomes http://localhost:8080/newpath#/ . Is there a config variable I can set so that the #/ is not appended to every URL? Using regex to remove it on every URL seems really unwieldily. I am not including

【bug】关于微信ios展示页面的url和实际url不一致的问题

我的未来我决定 提交于 2019-12-19 16:50:19
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 如题描述。 用户打开的页面url和实际url不一致,假如展示的页面是www.baidu.com.,微信端复制链接地址,出来的是www.163.com。 当然实际项目中出现的只是路由不一样,域名是相同的。 由于这样的原因,导致了页面上的二维码,识别不出来。就是长按没有识别二维码的选项。 经过排查,大概找到了原因就是因为地址不一致造成的。 因为微信授权我们采用了后台授权,使用window.location.href='后台授权地址’.,然后再返回前端。 由此,当用户没有关注公众号的时候,我们用了vue-router,进行了路由跳转,this.$router.push, 所以就出现了 this.$router.push是执行了,页面跳转了,可是页面的地址是window.location.href='后台授权地址’., 后来没有采用this.$router.push。而是直接用window.location.href进行跳转解决了该问题。 来源: oschina 链接: https://my.oschina.net/u/3883810/blog/1928855

How to destroy a VueJS component that is being cached by <keep-alive>

与世无争的帅哥 提交于 2019-12-19 10:29:26
问题 I have a Vue component that's kept alive using Vue's element for caching purposes. However, the problem I am having right now is that once I sign out of one account and create a new account on my Vue application, the component I'm "keeping alive" is being reflected for the new user (which obviously isn't relevant for the new user). As a result, I want to destroy that component once the user signs out. What is the best way to go about this? 回答1: I've managed to solve my issue in the following

Problems with vue router (history mode) in development server Vue.js - “Cannot GET /config”

纵然是瞬间 提交于 2019-12-19 10:23:17
问题 I just wanted to setup my vue project with the full webpack template, use vue router and link different urls to different components. The src/router/index.html is the following: import Vue from 'vue'; import Router from 'vue-router'; // eslint-disable-next-line import Home from '../pages/home.vue'; // eslint-disable-next-line import Config from '../pages/config.vue'; Vue.use(Router); export default new Router({ mode: 'hash', routes: [ { path: '/', component: Home }, { path: '/config',

Vue.js Router: Run code when component is ready

て烟熏妆下的殇ゞ 提交于 2019-12-19 09:47:43
问题 I'm working on a single-page app with Vue.js and its official router. I have a menu and a component (.vue file) per every section which I load using the router. In every component I have some code similar to this: <template> <div> <!-- MY DOM --> </div> </template> <script> export default { data () {}, methods: {}, route: { activate() {}, }, ready: function(){} } </script> I want to execute a piece of code (init a jQuery plugin) once a component has finished transitioning in. If I add my code

vue-router in conjunction with laravel routes

。_饼干妹妹 提交于 2019-12-19 09:24:21
问题 I have setup vue-router successfully but I have some problem mixing it with my laravel 5.3 routes. I have a php route for home: Route::get('/', array('as' => 'home', 'uses' => 'HomeController@showWelcome')); and I have setup vue-router routes: '/user-feed': { name: 'user-feed', title: 'User Feed', component: Feed }, '*': { component: PageNotFound } In my web.php route file, I have the following: Route::get('/', array('as' => 'home', 'uses' => 'HomeController@showWelcome')); // use vue-router

How to use addroutes method in Vue-router?

牧云@^-^@ 提交于 2019-12-19 07:51:18
问题 I have created a function "addroute()" to add routes dynamically,but it didn't work(the router does not changed). Is this a right way to use addRoutes method? I have learned this from tutorial. If not then give me a correct example,Thanks! ... const Bar={ template:'#panels', data(){ return {title:'badss'} } }; const Foo={ template:"#panels", data(){ return {title:'hell'} } }; const router = new VueRouter({ routes:[ {path:'/foo',component:Foo}, {path:'/bar',component:Bar} ] }); new Vue({ el:'

Vue.js, pass data to component on another route

我的未来我决定 提交于 2019-12-19 04:05:31
问题 Simple task to pass data from one page to another made a real headache to newbie in Vue.js Here is my router I'm rendering a form on "/" page, which make an API request, and I just want to pass data to another route page with another component Is it so hard to do in Vue? It made a real headache for me today. Get data from API, save & send to another component. How can I do it? 回答1: As Antony said, since you've already enabled props in router/index.js , you can pass parameters in router.push