发表日期:2018-08 文章编辑:小灯 浏览次数:911
mpvue的坑
用途
参考文档: npm-mpvue-entry
重点参考文档: https://github.com/F-loat/mpvue-entry
参考配置文档: mpvue-issue-F-loat的回答
npm i mpvue-entry --save 操作了半天,mpvue-entry的作者为了方便大家使用,开源了基于mpvue-entry的模版,大家可以直接使用这个quickStart进行构建项目
mpvue-entry-quickStart 项目地址: mpvue-entry-quickStart
$ npm install -g vue-cli$ vue init F-loat/mpvue-quickstart my-project$ cd my-project$ npm install$ npm run dev 参考文档: https://github.com/F-loat/mpvue-entry
// pages.js module.exports = [{path: 'pages/news/list', // 页面路径,同时是 vue 文件相对于 src 的路径,必填config: { // 页面配置,即 page.json 的内容,可选navigationBarTitleText: '文章列表',enablePullDownRefresh: true}} ] module.exports = [ // 主包 { path: 'pages/cardList/index', // 页面路径,同时是 vue 文件相对于 src 的路径 }, { path: 'pages/card/index' },// 分包 { path: 'packageA/logs', subPackage: true, config: { // 页面配置,即 page.json 的内容 navigationBarTitleText: '查看启动日志' } } ] 参考文档: 小程序文档-配置
// 主 main.js 文件 import Vue from 'vue' import App from '@/App' import store from '@/store'Vue.config.productionTip = false App.store = store App.mpType = 'app'const app = new Vue(App) app.$mount()export default { // 这个字段走 app.json config: { pages: [], window: { backgroundTextStyle: 'light', navigationBarBackgroundColor: '#fff', navigationBarTitleText: 'WeChat', navigationBarTextStyle: 'black' }, // tabBar 配置 tabBar: { backgroundColor: "#fafafa", borderStyle: "white", selectedColor: "#b4282d", color: "#666", list: [ { pagePath: "pages/cardList/index", iconPath: "static/images/ic_menu_choice_nor.png", selectedIconPath: "static/images/ic_menu_choice_pressed.png", text: "cardlist" }, { pagePath: "pages/card/index", iconPath: "static/images/ic_menu_choice_nor.png", selectedIconPath: "static/images/ic_menu_choice_pressed.png", text: "card" }, ] } } } BY-Luca_LJX(git地址