| | |
| | | // #ifndef VUE3 |
| | | import Vue from 'vue' |
| | | import uView from './uni_modules/uview-ui/index.js' |
| | | import store from './store' |
| | | import './uni.promisify.adaptor' |
| | | Vue.config.productionTip = false |
| | | Vue.prototype.$store = store |
| | | App.mpType = 'app' |
| | | const app = new Vue({ |
| | | store, |
| | | ...App |
| | | }) |
| | | app.$mount() |
| | |
| | | </view> |
| | | </uni-popup> |
| | | |
| | | |
| | | |
| | | <!-- 版本号 --> |
| | | <!-- #ifdef APP-PLUS --> |
| | | <view class="version"> |
| | |
| | | <template> |
| | | <view> |
| | | <text>{{username}}</text> |
| | | <text>{{age}}</text> |
| | | <view class="z-swiper"> |
| | | <view> |
| | | 今日入库 100 |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { mapState } from 'vuex'//引入mapState |
| | | export default { |
| | | data() { |
| | | return { |
| | | homeList: [ |
| | | {name: '入库',nav:[ |
| | | {name: '组托入库'}, |
| | | {name: '上架'} |
| | | ]}, |
| | | {name: '出库'}, |
| | | {name: '其他'}] |
| | | } |
| | | } |
| | | return {} |
| | | }, |
| | | onShow() { |
| | | console.log(this.project); |
| | | }, |
| | | computed: mapState({ |
| | | // 从state中拿到数据 箭头函数可使代码更简练 |
| | | username: state => state.username, |
| | | age: state => state.age, |
| | | homeList: state => state.homeList, |
| | | project: state => state.project |
| | | }) |
| | | } |
| | | </script> |
| | | |
New file |
| | |
| | | { |
| | | "phps": { |
| | | "name":"平湖品上新发现", |
| | | "menu": [ |
| | | {"name": "组托入库"}, |
| | | {"name": "订单组托"} |
| | | ] |
| | | } |
| | | } |
New file |
| | |
| | | // 页面路径:store/index.js |
| | | import Vue from 'vue' |
| | | import Vuex from 'vuex' |
| | | import project from '@/pages/project/project' |
| | | |
| | | Vue.use(Vuex);//vue的插件机制 |
| | | |
| | | //Vuex.Store 构造器选项 |
| | | const store = new Vuex.Store({ |
| | | state:{//存放状态 |
| | | "username":"foo", |
| | | "age":18, |
| | | "homeList": [ |
| | | { |
| | | name: '入库', |
| | | nav:[ |
| | | {name: '组托入库'}, |
| | | {name: '上架'} |
| | | ], |
| | | }, |
| | | {name: '出库'}, |
| | | {name: '其他'}, |
| | | ], |
| | | 'project': project |
| | | } |
| | | }) |
| | | export default store |