dai-vue-temp-m
更改列表
main/index.html 4(+1 -3)
main/index.js 5(+2 -3)
main/store.js 2(+1 -1)
src/index.js 2(+1 -1)
src/models/api.js 16(+13 -3)
src/models/routes.js 5(+1 -4)
src/page/home.vue 5(+4 -1)
详细信息
main/index.html 4(+1 -3)
diff --git a/main/index.html b/main/index.html
index f7ada08..b6f1c3e 100644
--- a/main/index.html
+++ b/main/index.html
@@ -12,11 +12,9 @@
<meta http-equiv="Expires" content="0" /> -->
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
- <body class="tgj-body">
+ <body>
<div id="dai-app" class="dai-app d-box-v">
<router-view class="d-box-flex"></router-view>
</div>
- <script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
- <script src="https://js.cdn.aliyun.dcloud.net.cn/dev/uni-app/uni.webview.1.5.2.js"></script>
</body>
</html>
main/index.js 5(+2 -3)
diff --git a/main/index.js b/main/index.js
index 4acdd81..661c52c 100644
--- a/main/index.js
+++ b/main/index.js
@@ -1,9 +1,8 @@
-import { DaiVue } from 'dai-vue';
+import { DaiVue, Vuex } from 'dai-vue';
import * as modules from './modules.js';
import config from './config/config.js';
import interceptor from './interceptor.js';
import store from './store.js';
-import { mapGetters } from 'vuex';
import './style.less';
@@ -20,7 +19,7 @@ window.baseVue = DaiVue(
components: {},
//计算属性
computed: {
- ...mapGetters(['vx_userInfo'])
+ ...Vuex.mapGetters(['vx_userInfo'])
}
},
{
main/store.js 2(+1 -1)
diff --git a/main/store.js b/main/store.js
index 51c4a49..033e7f2 100644
--- a/main/store.js
+++ b/main/store.js
@@ -1,4 +1,4 @@
-import {Vue,Vuex} from 'dai-vue';
+import { Vue, Vuex } from 'dai-vue';
Vue.use(Vuex);
//创建VueX对象
const store = new Vuex.Store({
src/index.js 2(+1 -1)
diff --git a/src/index.js b/src/index.js
index 0edd8a5..5ff0e30 100644
--- a/src/index.js
+++ b/src/index.js
@@ -5,4 +5,4 @@ export default {
api,
routes,
models
-};
\ No newline at end of file
+};
src/models/api.js 16(+13 -3)
diff --git a/src/models/api.js b/src/models/api.js
index 3f554a3..5d3a2da 100644
--- a/src/models/api.js
+++ b/src/models/api.js
@@ -1,9 +1,19 @@
var test = {
$config: {
- baseURL: '/tes/'
+ /**读取配置文件中 service 字段,默认 default*/
+ service: 'default',
+ /**基础URL */
+ baseURL: '/test/',
+ /**请求方式,不配置为 payload*/
+ requestType: 'formData'
},
- async zi(data) {
- return await this.$get('zi', data);
+ /**
+ * 接口方法 在 vue 页面中可以使用方法 await this.$api.test.test({});
+ * @param {Object} data
+ * @returns
+ */
+ async test(data) {
+ return await this.$get('test', data);
}
};
export { test };
src/models/routes.js 5(+1 -4)
diff --git a/src/models/routes.js b/src/models/routes.js
index a83d158..c41e7b5 100644
--- a/src/models/routes.js
+++ b/src/models/routes.js
@@ -1,5 +1,2 @@
-import home from '../page/home.vue';
-const routes = [
- { path: '/', component: home, meta: { pageName: '首页' } },
-];
+const routes = [{ path: '/', component: () => import('../page/home.vue'), meta: { pageName: '首页' } }];
export default routes;
src/page/home.vue 5(+4 -1)
diff --git a/src/page/home.vue b/src/page/home.vue
index ea64fce..b625459 100644
--- a/src/page/home.vue
+++ b/src/page/home.vue
@@ -8,6 +8,7 @@
</div>
</template>
<script type="text/javascript">
+import { Vuex } from 'dai-vue';
export default {
props: {},
data() {
@@ -19,7 +20,9 @@ export default {
created() {},
mounted() {},
//计算属性
- computed: {},
+ computed: {
+ ...Vuex.mapGetters(['vx_userInfo'])
+ },
destroyed() {}
};
</script>
\ No newline at end of file