Skip to content

Commit 9f9e7eb

Browse files
author
w-xuefeng
committed
feat: add pugins
1 parent 87164a2 commit 9f9e7eb

File tree

7 files changed

+106
-119
lines changed

7 files changed

+106
-119
lines changed

src/components/BottomNav.vue

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<template>
2+
<div class="bottomNav">
3+
13245879
4+
</div>
5+
</template>
6+
7+
<script>
8+
export default {
9+
name: 'BottomNav',
10+
props: {
11+
title: String
12+
}
13+
};
14+
</script>
15+
16+
<!-- Add "scoped" attribute to limit CSS to this component only -->
17+
<style scoped lang="scss">
18+
.bottomNav {
19+
height: 60px;
20+
width: 100%;
21+
padding-bottom: 20px;
22+
position: absolute;
23+
bottom: 0;
24+
left: 0;
25+
}
26+
</style>

src/components/ComHeader.vue

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<template>
2+
<div class="headre">
3+
<span>{{ title }}</span>
4+
</div>
5+
</template>
6+
7+
<script>
8+
export default {
9+
name: 'ComHeader',
10+
props: {
11+
title: String
12+
}
13+
};
14+
</script>
15+
16+
<!-- Add "scoped" attribute to limit CSS to this component only -->
17+
<style scoped lang="scss">
18+
.headre {
19+
height: 50px;
20+
width: 100%;
21+
padding-top: 30px;
22+
color: #ffffff;
23+
font-size: 20px;
24+
display: flex;
25+
justify-content: center;
26+
align-items: center;
27+
background-image: linear-gradient(
28+
45deg,
29+
rgb(108, 189, 255) 0%,
30+
rgb(7, 87, 179) 100%
31+
);
32+
}
33+
</style>

src/components/HelloWorld.vue

Lines changed: 0 additions & 114 deletions
This file was deleted.

src/config/ui.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default {
2+
3+
}

src/main.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import App from './app';
22
import Vue from 'vue';
3+
import apicloud from '@/utils/common';
34

5+
Vue.use(apicloud);
46
Vue.config.productionTip = false;
57

68
new Vue({

src/pages/index/index.vue

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,26 @@
11
<template>
2-
<div class="index">{{ title }}</div>
2+
<div class="index">
3+
<com-header :title="title" />
4+
<button
5+
style="height:100px; width: 100%; background: deepskyblue"
6+
@click="$openPage({ name: 'login', url: 'loginindex.html' })"
7+
>
8+
123456
9+
</button>
10+
</div>
311
</template>
412

513
<script>
14+
import ComHeader from '@/components/ComHeader';
15+
616
export default {
717
name: 'index',
18+
components: {
19+
ComHeader
20+
},
821
data() {
922
return {
10-
title: 'lalala'
23+
title: '首页'
1124
};
1225
},
1326
mounted() {}
@@ -16,8 +29,6 @@ export default {
1629

1730
<style lang="scss" scoped>
1831
.index {
19-
width: 100px;
20-
color: #000;
21-
background: dodgerblue;
32+
width: 100%;
2233
}
2334
</style>

src/utils/common.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
export class APICloud {
2+
$isMobile = typeof api !== 'undefined';
3+
4+
openWin(params) {
5+
console.log(typeof api);
6+
if (this.$isMobile) {
7+
window.api.openWin(params);
8+
} else {
9+
location.href = params.url;
10+
}
11+
}
12+
13+
install = Vue => {
14+
if (this.$isMobile) {
15+
Vue.prototype.$api = window.api;
16+
}
17+
Vue.prototype.$isMobile = this.$isMobile;
18+
Vue.prototype.$openPage = this.openWin;
19+
Vue.mixin({
20+
created: function() {}
21+
});
22+
};
23+
}
24+
25+
const apicloud = new APICloud();
26+
export default apicloud;

0 commit comments

Comments
 (0)