@@ -3,16 +3,19 @@ import axios from 'axios';
33const carbonUrls = {
44 ' vuecomponent.github.io' : ' //cdn.carbonads.com/carbon.js?serve=CK7DL2JW&placement=vuecomponentgithubio' ,
55 ' tangjinzhou.gitee.io' : ' //cdn.carbonads.com/carbon.js?serve=CK7DL2JN&placement=tangjinzhougiteeio' ,
6+ ' vue.ant.design' : ' //cdn.carbonads.com/carbon.js?serve=CK7DL2JW&placement=vuecomponentgithubio' ,
67};
7- const carbonUrl = ' //cdn.carbonads.com/carbon.js?serve=CK7DL2JW&placement=vuecomponentgithubio' || carbonUrls[location .host ];
8- const isGitee = location .host .indexOf (' gitee' ) !== - 1 ;
8+ const carbonUrl = carbonUrls[location .host ] || ' //cdn.carbonads.com/carbon.js?serve=CK7DL2JW&placement=vuecomponentgithubio' ;
99export default {
10+ props: {
11+ isMobile: Boolean ,
12+ },
1013 watch: {
1114 $route (e, t) {
1215 let adId = ' #carbonads' ;
13- if (isGitee) {
14- adId = ' #cf' ;
15- }
16+ // if(isGitee) {
17+ // adId = '#cf';
18+ // }
1619 if (e .path !== t .path && this .$el .querySelector (adId)){
1720 this .$el .innerHTML = " " ;
1821 this .load ();
@@ -32,12 +35,13 @@ export default {
3235 },
3336 methods: {
3437 load () {
35- if (isGitee) {
36- axios .get (' https://api.codefund.app/properties/162/funder.html?template=horizontal' )
37- .then (function (response ) {
38- document .getElementById (" codefund-ads" ).innerHTML = response .data ;
39- });
40- } else if (carbonUrl) {
38+ // if(isGitee) {
39+ // axios.get('https://api.codefund.app/properties/162/funder.html?template=horizontal')
40+ // .then(function (response) {
41+ // document.getElementById("codefund-ads").innerHTML = response.data;
42+ // });
43+ // } else
44+ if (carbonUrl) {
4145 const e = document .createElement (" script" );
4246 e .id = " _carbonads_js" ;
4347 e .src = carbonUrl;
@@ -47,13 +51,14 @@ export default {
4751 },
4852 render () {
4953 return (
50- isGitee ? < div id= " codefund -ads" / > : < div id = " carbon-ads " / >
54+ < div id= " carbon -ads" class = { this . isMobile ? ' carbon-mobile ' : ' ' } / >
5155 );
5256 },
5357};
5458 </script >
55- <style >
59+ <style lang="less" >
5660 #carbon-ads {
61+ overflow : hidden ;
5762 width : 145px ;
5863 position : fixed ;
5964 z-index : 9 ;
@@ -63,6 +68,7 @@ export default {
6368 background-color : #fff ;
6469 border-radius : 3px ;
6570 font-size : 13px ;
71+ background : #f5f5f5 ;
6672 font-family : " Source Sans Pro" , " Helvetica Neue" , Arial , sans-serif ;
6773}
6874#carbon-ads a {
@@ -72,20 +78,18 @@ export default {
7278}
7379#carbon-ads span {
7480 color : #7f8c8d ;
75- display : inline-block ;
76- margin-bottom : 5px ;
7781}
7882#carbon-ads img {
7983 width : 125px ;
8084}
8185#carbon-ads .carbon-img ,
8286#carbon-ads .carbon-text {
8387 display : block ;
84- margin-bottom : 6px ;
8588 font-weight : normal ;
8689 color : #34495e ;
8790}
8891#carbon-ads .carbon-text {
92+ margin-top : 6px ;
8993 display : -webkit-box ;
9094 -webkit-box-orient : vertical ;
9195 -webkit-line-clamp : 4 ;
@@ -95,5 +99,17 @@ export default {
9599 color : #aaa ;
96100 font-weight : normal ;
97101 line-height : 1.2 ;
102+ margin-top : 6px ;
103+ }
104+ #carbon-ads .carbon-mobile {
105+ width : 100% ;
106+ position : relative ;
107+ right : 0 ;
108+ bottom : 0 ;
109+ padding : 0 ;
110+ .carbon-img {
111+ float : left ;
112+ margin-right : 10px ;
113+ }
98114}
99115 </style >
0 commit comments