vue-router

Vuejs, Difficulties to build with relative path

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-18 15:43:12
问题 I'm facing difficulties to make a proper build with a relative path when I run npm run build . Resolving assets is easy but I don't know how to configure 2 things: 1/ The assetsPublicPath in config/index.js // see http://vuejs-templates.github.io/webpack for documentation. var path = require('path') module.exports = { build: { env: require('./prod.env'), index: path.resolve(__dirname, '../dist/index.html'), assetsRoot: path.resolve(__dirname, '../dist'), assetsSubDirectory: 'static',

Vue Router hosting on apache2

…衆ロ難τιáo~ 提交于 2019-12-18 12:32:28
问题 I am hosting my vuejs project on apache server. init project setup router Build and hosted to apache server const router = new VueRouter({ routes: Routes, // relative: true, mode: 'history' }); This runs fine in local, but vue router breaks on server. Example If I run http://example.com and go to http://exmaple.com/sub It works fine but if I refresh the page It will throw 404 Error. Error: 回答1: From the vue.js documentation page: When using history mode, the URL will look "normal," e.g. http:

Vue-router error: TypeError: Cannot read property 'matched' of undefined

∥☆過路亽.° 提交于 2019-12-18 12:21:03
问题 I'm trying to write my first Vuejs app. I'm using vue-cli and simple-webpack boilerplate. When I add vue-router links to my app component I get this error in console Error in render function: "TypeError: Cannot read property 'matched' of undefined" Here is my code: App.vue <template> <div> <h2>Links</h2> <ul> <router-link to='/'>Home</router-link> <router-link to='/query'>Query</router-link> <router-view></router-view> </ul> </div> </template> <script> export default {} </script> main.js

vue-router学习

ぃ、小莉子 提交于 2019-12-18 04:40:41
一、router路由发展的几个阶段 1、后端路由阶段 后端渲染:前端只有html和css,后端通过jsp等技术渲染页面,再交给前端。 后端路由:后端处理url和页面映射之间的关系。后端通过正则匹配url,controller控制器来处理匹配的页面,把html返回给前端。 2、前后端分离阶段 后端负责数据, 前端渲染:网页中的内容大部分是由前端写的js在浏览器中执行,后端负责提供API和数据 3、前端路由阶段(SPA单页面富应用阶段) 整个网页只有一个html页面(包含html+css+js),当用户点击时,从url1–>url2,通过前端路由,加载url2的内容(在vue中就是加载一个组件。) 改变url页面不整体刷新,两种实现方式: (1)改变url的hash,location.hash=‘aaa’ (2)html5中的history模式pushState,history.pushState({},’’,‘home’)三个参数为data title url。 history.pushState入栈 history.go(-1)=history.back()出栈 history.forward()=history.go(1) 二、基础知识0 1、懒加载 build打包时,appxxx.js文件变得很大,使用懒加载更高效。 router懒加载:用到的时候再加载

Vue.js - Making helper functions globally available to single-file components

旧街凉风 提交于 2019-12-17 22:33:14
问题 I have a Vue 2 project that has many (50+) single-file components. I use Vue-Router for routing and Vuex for state. There is a file, called helpers.js , that contains a bunch of general-purpose functions, such as capitalizing the first letter of a string. This file looks like this: export default { capitalizeFirstLetter(str) { return str.charAt(0).toUpperCase() + str.slice(1); } } My main.js file initializes the app: import Vue from 'vue' import VueResource from "vue-resource" import store

初探vue,react,angular的感受

戏子无情 提交于 2019-12-17 16:20:01
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 虽然干了10年的前端,但是我一直把重心心放在标准和 跨屏 网站建设 的用户体验上面,我依旧认为任何好的技术最终的目的就是用户体验,只有好的用户体验才是促进成交的砝码,我们应该把中心放在用户体验上,任何网页端的技术脱离了用户体验,都是鸡肋。 –aming 下面说一说我初探vue等js框架的感受: 一共断断续续研究了一个月,之前没有去触及的主要原因是,工作的需求没有涉及到这一块,加上我把定位放在了网页用户体验和网页标准上面,直到今年才开始真真的想到用vue去做一个完整的项目,看看对于用户体验上是否真正有实质性的提高。 对于有10年经验的来说,vue到没有难倒我,并且我抛开了很多干扰(比如需要先安装node.js,然后vue-cli脚手架,然后打包等繁琐的流程),而是选择了直奔主题,直接引用vue.js就开干了。第一个vue项目选择了 切图网 以前的一个“未来教育”的h5项目,用到了vue-router实现单页路由,然后配合jquery的ajax获取数据,实现数据的获取的绑定。 这是一个非常简单的尝试,并且这个方法被证实可行,可运用在一个真实的实战项目中,好了先写到这里,后续有在补充。 来源: oschina 链接: https://my.oschina.net/u/3753812/blog/1594157

What is <router-view :key=“$route.fullPath”> ?

眉间皱痕 提交于 2019-12-17 12:20:50
问题 I'm completely new to Vue.js and I think I have a bit of understanding of how a router works with things like: <router-link to="/"> But I am not really understanding what the following line does: <router-view :key="$route.fullPath"></router-view> I believe router-view by itself makes sure the content is displayed but what does the key part mean? 回答1: See Special Attributes - key It can also be used to force replacement of an element/component instead of reusing it. This can be useful when you

What is <router-view :key=“$route.fullPath”> ?

纵然是瞬间 提交于 2019-12-17 12:20:10
问题 I'm completely new to Vue.js and I think I have a bit of understanding of how a router works with things like: <router-link to="/"> But I am not really understanding what the following line does: <router-view :key="$route.fullPath"></router-view> I believe router-view by itself makes sure the content is displayed but what does the key part mean? 回答1: See Special Attributes - key It can also be used to force replacement of an element/component instead of reusing it. This can be useful when you

Laravel VueJs : `router-view` does not render the component

﹥>﹥吖頭↗ 提交于 2019-12-17 10:06:35
问题 I know such questions are out there in this site but they do not solve my problem. Hence this question pops up here : In my Laravel 5.3 and VueJs app, the root instance of Vue in app.js file points to App.vue and in App.vue I have the router-view placeholder. So I expect page components to be rendered inside the placeholder but that does not happen. Let me show the contents in different files: In web.php I have : Route::get('/listing/{listing}', function(Listing $listing){ $model = $listing-

Vue.js+Node.js+Mongodb+Express+Bootstrap搭建个人博客

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-17 03:04:16
1 概述 花了半年时间学习,然后开发的个人博客,目前我的博客正在使用。 博客前端展示页面见这里,顺便安利一波小站,嘻嘻 。 后台管理部分如图。 后台首页。 后台管理,包括博客的删除、修改和是否隐藏。 写博客。 2 技术栈 前端使用到的技术有: vue vue-router vuex bootstrap-vue 前端用到的插件有: sweetalert2 (弹出框,注意有2,不是sweetalert,两个用法有较大差别) mavon-editor (markdown语法编辑器) vue-axios (ajax) vue-backtotop (回到顶部按钮) sha1 @voerro/vue-tagsinput (标签输入) 后端用到的技术栈有: node.js express mongodb mongoose multer jsonwebtoken 后端用到的插件有: config-lite (方便配置) body-parser express-winston (记录请求日志) 3 技术点详解 **注意,本博客源码使用的是vue脚手架创建的项目。所以下面的部分都是针对脚手架项目而言的哟。**源码文章末尾会给出链接。 3.1 技术图谱 技术图谱其实就是svg,当然这不是一个一个点用代码写出来的,使用 svg编辑器 绘制出来的。 是个体力活来的。我个人画了两个,一个用在移动端