摘要:解决方案一:nginx代理转发 项目build后,通过nginx代理转发 location / { root D:\myproject\my-vue\dist; index index.html index.htm; } location /pyapi { proxy_pass 'http://lo
阅读全文
摘要:1. 入口文件index.js import Vuex from 'vuex' import Vue from 'vue' import modulesA from './modules/modulesA' // 注册vuex到vue中 Vue.use(Vuex) const state = { c
阅读全文
摘要:有时候页面会先出现源码,再显示解析的内容。可以通过v-cloak解决 v-cloak 这个指令会作为元素的一个属性一直保持到vue实例编译结束,即解析后移除此指令。 /* 含有v-cloak的html元素不显示 */ [v-cloak]{ display:none; } <!-- v-cloak指令
阅读全文
摘要:简而言之,作用域插槽就是让插槽内容能够访问子组件中的数据。 案例如下:有CurUser组件 <template> <span> <!-- 在slot 元素上绑定user,让父组件插槽能够访问 --> <slot :user="user"></slot> </span> </template> <sc
阅读全文
摘要:父组件通过 props 传值给子组件,子组件通过 $emit 来通知父组件修改相应的props值,子组件可以通过watch监听父组件值变化。案例如下: 1.子组件 <template> <div class="com"> <input type="text" @input="inputChange"
阅读全文
摘要:1. 安装组件和插件 cnpm i element-ui -S // 安装elementcnpm i vue-i18n -S //安装i18n 2.将国际化资源放在assets目录下 3.在src下新建i18n目录,创建一个 index.js;路径src\i18n\index.js 4.在main.
阅读全文
摘要:2.代码中实现路由跳转 3.路由拦截设置页面title
阅读全文