File tree Expand file tree Collapse file tree 15 files changed +235
-145
lines changed Expand file tree Collapse file tree 15 files changed +235
-145
lines changed Original file line number Diff line number Diff line change 99 "lint" : " vue-cli-service lint --fix -C .eslintrc.js --ext .js,.vue ./src"
1010 },
1111 "dependencies" : {
12- "axios" : " ^0.19.0" ,
1312 "core-js" : " ^3.3.2" ,
1413 "vant" : " ^2.2.15" ,
1514 "vue" : " ^2.6.10"
2625 "eslint-plugin-prettier" : " ^3.1.1" ,
2726 "eslint-plugin-vue" : " ^5.0.0" ,
2827 "glob" : " ^7.1.1" ,
29- "node-sass" : " ^4.12 .0" ,
28+ "node-sass" : " ^4.13 .0" ,
3029 "prettier" : " ^1.18.2" ,
3130 "sass-loader" : " ^8.0.0" ,
3231 "vue-template-compiler" : " ^2.6.10"
Original file line number Diff line number Diff line change 55 <span >返回</span >
66 </div >
77 <span >{{ title }}</span >
8+ <div v-if =" right" class =" right" @click =" rightClick()" >
9+ <slot name =" right" />
10+ </div >
811 </div >
912</template >
1013
@@ -18,9 +21,24 @@ export default {
1821 },
1922 props: {
2023 title: String ,
24+ framePathName: {
25+ type: String ,
26+ required: true
27+ },
2128 back: {
2229 type: Boolean ,
2330 default: false
31+ },
32+ right: {
33+ type: Boolean ,
34+ default: false
35+ }
36+ },
37+ methods: {
38+ rightClick () {
39+ this .api .sendEvent ({
40+ name: ` ${ this .framePathName } HeaderRightClick`
41+ });
2442 }
2543 },
2644 onReady () {
@@ -54,5 +72,12 @@ export default {
5472 display : flex ;
5573 align-items : center ;
5674 }
75+ .right {
76+ position : absolute ;
77+ right : 15px ;
78+ font-size : 1em ;
79+ display : flex ;
80+ align-items : center ;
81+ }
5782}
5883 </style >
Original file line number Diff line number Diff line change @@ -39,6 +39,11 @@ const pages = [
3939 name : 'headwin' ,
4040 path : 'headwin/index'
4141 } ,
42+ {
43+ title : '哒哒' ,
44+ name : 'dada' ,
45+ path : 'dada/index'
46+ }
4247] ;
4348
4449module . exports = pages
Original file line number Diff line number Diff line change @@ -37,6 +37,12 @@ export const frameGroupOpts = {
3737 {
3838 name : 'frameGroup-clock' ,
3939 pathName : 'clock' ,
40+ options : {
41+ right : true ,
42+ rightOptions : {
43+ icon : 'clock-o'
44+ }
45+ }
4046 } ,
4147 {
4248 name : 'frameGroup-myhome2' ,
@@ -51,9 +57,15 @@ export const frameGroupOpts = {
5157
5258export const homeGridPane = [
5359 {
54- text : '啦啦 ' ,
60+ text : '哒哒 ' ,
5561 icon : 'records' ,
56- pathName : 'leave'
62+ pathName : 'dada' ,
63+ options : {
64+ right : true ,
65+ rightOpts : {
66+ icon : 'notes-o'
67+ }
68+ }
5769 } ,
5870 {
5971 text : '文字' ,
Original file line number Diff line number Diff line change 99<script >
1010export default {
1111 name: ' home1' ,
12+ apiEvent: {
13+ clockHeaderRightClick () {
14+ alert (' 点击了头部右侧按钮' );
15+ }
16+ },
1217 onReady () {
1318 this .$bindKeyBackExitApp ();
1419 }
Original file line number Diff line number Diff line change 1+ <template >
2+ <div class =" dada" >
3+ <h1 >哒哒</h1 >
4+ </div >
5+ </template >
6+
7+ <script >
8+ export default {
9+ name: ' dada' ,
10+ data () {
11+ return {};
12+ },
13+ apiEvent: {
14+ tap () {
15+ alert (' 点击了页面' );
16+ api .setScreenOrientation ({
17+ orientation: ' auto'
18+ });
19+ },
20+ dadaHeaderRightClick () {
21+ alert (' 点击了头部右侧按钮' );
22+ }
23+ },
24+ methods: {},
25+ onReady () {}
26+ };
27+ </script >
28+
29+ <style lang="scss" scoped>
30+ .dada {
31+ width : 100% ;
32+ height : 100vh ;
33+ display : flex ;
34+ align-items : center ;
35+ justify-content : center ;
36+ }
37+ </style >
Original file line number Diff line number Diff line change 11<template >
22 <div class =" head-window" >
3- <com-header :title =" title" :back =" back" />
3+ <com-header
4+ :title =" title"
5+ :back =" back"
6+ :right =" right"
7+ :framePathName =" framePathName"
8+ >
9+ <template v-slot :right >
10+ <Icon :name =" rightIcon" />
11+ </template >
12+ </com-header >
413 </div >
514</template >
615
716<script >
817import ComHeader from ' @/components/ComHeader' ;
918import { frameTabChange } from ' @/config/eventName' ;
19+ import { Icon } from ' vant' ;
1020
1121export default {
12- name: ' index ' ,
22+ name: ' headWin ' ,
1323 components: {
14- ComHeader
24+ ComHeader,
25+ Icon
1526 },
1627 data () {
1728 return {
1829 title: ' ' ,
19- back: false
30+ back: false ,
31+ right: false ,
32+ rightIcon: ' ' ,
33+ framePathName: ' '
2034 };
2135 },
2236 methods: {
@@ -44,9 +58,12 @@ export default {
4458 rect = {},
4559 title,
4660 back,
61+ right,
62+ rightOpts,
4763 tab,
4864 tabsFrameName,
4965 tabOpts,
66+ name,
5067 frameGroup,
5168 frameGroupOpts = {},
5269 bindKeyBackExitApp
@@ -62,6 +79,10 @@ export default {
6279 }
6380 this .title = title || ' 标题' ;
6481 this .back = back;
82+ this .right = right;
83+ if (right) {
84+ this .rightIcon = rightOpts .icon ;
85+ }
6586 if (frameGroup) {
6687 const { name , rect = {}, frames } = frameGroupOpts;
6788 frames .forEach (e => {
@@ -82,15 +103,25 @@ export default {
82103 if (tab && tabOpts) {
83104 this .title = tabOpts .tabs [ret .index ].text ;
84105 }
106+ this .framePathName = frames [ret .index ].pathName ;
107+ if (frames [ret .index ].options ) {
108+ const { right , rightOptions } = frames [ret .index ].options ;
109+ this .right = right;
110+ this .rightIcon = rightOptions .icon ;
111+ } else {
112+ this .right = false ;
113+ this .rightIcon = ' ' ;
114+ }
85115 this .api .sendEvent ({
86116 name: frameTabChange,
87117 extra: { ... ret }
88118 });
89119 }
90120 );
91121 } else {
122+ this .framePathName = name;
92123 this .$frame .open ({
93- name: pageParam . name ,
124+ name,
94125 rect: {
95126 x: rect .x || 0 ,
96127 y: rect .y || headerRH,
Original file line number Diff line number Diff line change 55 src =" res/img/logo.png"
66 width =" 50%"
77 style =" margin : 80px auto 30px auto ;display : block ;"
8- alt =" "
8+ alt =" logo "
99 />
1010 </div >
1111 <div class =" content" >
1515 :key =" i"
1616 :icon =" g.icon"
1717 :text =" g.text"
18- @click =" gotoSomeWhere(g.pathName, g.text)"
18+ @click ="
19+ gotoSomeWhere({
20+ pathName: g.pathName,
21+ title: g.text,
22+ options: g.options
23+ })
24+ "
1925 />
2026 </Grid >
2127 </div >
@@ -38,31 +44,29 @@ export default {
3844 };
3945 },
4046 methods: {
41- gotoSomeWhere (pathname , title ) {
42- if (! pathname ) return ;
47+ gotoSomeWhere ({ pathName , title, options } ) {
48+ if (! pathName ) return ;
4349 this .$pageWithHead ({
4450 title,
45- name: pathname,
46- back: true
51+ name: pathName,
52+ back: true ,
53+ ... options
4754 });
4855 }
4956 },
5057 apiEvent: {
51- tap () {
52- alert (' 点击了页面' );
53- api .setScreenOrientation ({
54- orientation: ' auto'
55- });
56- },
5758 scrolltobottom () {
5859 alert (' 已滚动到底部' );
60+ },
61+ swipeup () {
62+ api .refreshHeaderLoadDone ();
5963 }
6064 },
6165 onWindowChange () {
6266 alert (' lalala' );
6367 },
6468 onReady () {
65- this .$setPullDownRefresh (). then ( () => {
69+ this .$setPullDownRefresh (() => {
6670 api .refreshHeaderLoadDone ();
6771 });
6872 this .$bindKeyBackExitApp ();
Original file line number Diff line number Diff line change 11<template >
22 <div class =" home2" :style =" { paddingBottom: $tabRH() + 'px' }" >
33 <div class =" content" >
4- oooo
4+ 这里是哈哈
55 </div >
66 </div >
77</template >
@@ -20,5 +20,12 @@ export default {
2020 display : flex ;
2121 justify-content : center ;
2222 align-items : center ;
23+ .content {
24+ width : 100% ;
25+ height : calc (100vh - 120px );
26+ display : flex ;
27+ justify-content : center ;
28+ align-items : center ;
29+ }
2330}
2431 </style >
You can’t perform that action at this time.
0 commit comments