在js数据中如何引用图片
data () { return { imgUrl: '图片地址',//错误写法 imgUrl: require('图片地址')//正确的写法 }}template部分:img标签形式:<img :src="img" />或者div背景图形式:<div :style="{backgroundImage: 'url(' + img + ')'}"></div>
--save-dev和--save的区别
上面的这些依赖有些只在开发环境里面使用的模块,有的在项目上线之后还是要继续依赖的模块。他们之间的区别就在于我们平时安装模块依赖时的:--save-dev和 --save
当你使用--save-dev安装依赖的时候就会放在package.json的devDependencies对象下面,相反的,当你使用--save安装依赖的时候就会出现在dependencies对象下面。
总结: --save-dev 是你开发时候依赖的东西,--save 是你发布之后还依赖的东西。
作者:OBKoro1
链接:https://juejin.im/post/59be4d325188257e764c8485
来源:掘金
着作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
增加title标题
main.js
router.beforeEach((to, from, next) => { window.document.title = to.meta.title; next()})
index.js
export default new Router({ linkActiveClass: 'active', routes: [{ path: '/index', name: 'Index', component: Index, meta: { title: '首页' } }, { path: '/advantages', name: 'Advantage', component: Advantage, meta: { title: '中博优势' } }, { path: '/renovation', name: 'Renovation', component: Renovation, meta: { title: '产品简介' } }, { path: '/games', name: 'Games', component: Games, meta: { title: '游戏种类' } }, { path: '/service', name: 'Service', component: Service, meta: { title: '服务方案' } }, { path: '/contact', name: 'Contact', component: Contact, meta: { title: '联络我们' } } ]})