更新记录
1.0.12(2019-08-27) 下载此版本
更新
序号 | 内容 |
---|---|
1 | 更简洁的引用 |
2 | 自动引入组件 |
3 | APP返回事件监听关闭组件 |
1.0.1(2019-07-04) 下载此版本
修复了返回上一页这之后 组件不关闭的问题 改动文件
app.vue 监听路由变化关闭组件 并且新增路由 是第一次点击返回键时关闭组件 组件全部关闭时点击返回键才返回上一页
store/index.js 新增了关闭所有组件的方法
componentList.js 组件对应的 vuex 模块名称列表
1.0.0(2019-06-22) 下载此版本
1.0.0
查看更多平台兼容性
更新
序号 | 内容 |
---|---|
1 | 更简洁的引用 |
2 | 自动引入组件 |
3 | APP返回事件监听关闭组件 |
缺陷
自动关闭组件 小程序不支持, 需要在调用组件的页面 onbackpress事件关闭 todo: mixin
目录
├── components
│ └── system_
│ ├── components
│ ├── index.vue
│ ├── init_.js
│ ├── store
│ └── store_init.js
根目录 @/components/system_/
下边./
都是相对于这个目录
index.vue
组件入口,在main.js中引用并绑定未全局组件
import system_ from '@/components/system_/index';
Vue.component('system', system_)
./components/
组件文件夹,会在system_/index.vue
中自动引用, 模版中插入即可
./store_init
自动引入./store
中的vuex模块,返回一个对象,在store的入口文件引用
import Vue from 'vue'
import Vuex from 'vuex'
// import sync from '../npmPackege/node_modules/uni-vuex-sync'
import components from '@/components/system_/store_init.js'
Vue.use(Vuex)
const store = new Vuex.Store({
modules: {
// 这里引用组件
...components
},
// 启用严格模式
strict: true,
plugins: [],
mutations: {
hideall(){
// 遍历关闭所有组件的方法
for (const key in components) {
store.state[key].show=false
}
}
}
})
export default store
./init_.js
绑定组件的方法到Vue.prototype
,调用方法也在这里增加修改