This commit is contained in:
Pan 2018-10-08 15:42:46 +08:00
parent 28f80bc7cf
commit eb6b222ad2
3 changed files with 57 additions and 2 deletions

View File

@ -0,0 +1,52 @@
<template>
<div id="codefund_ad"/>
</template>
<script>
export default {
data() {
return {
loadSuccess: true
}
},
watch: {
'$route.path': {
handler: function(val, oldVal) {
window._codefund.serve()
}
}
},
mounted() {
this.addFundScript()
},
methods: {
addFundScript() {
if (this.$isServer) return
const codefundId = this.isGitee()
? 'c0e8a6c2-6717-402f-aea7-bfdcaaaf2329'
: 'c010d89c-46a8-4e3a-abf0-86b8a02874e4'
const script = window.document.createElement('script')
const template = 'horizontal'
script.onerror = this.loadError
script.src = `https://codefund.io/scripts/${codefundId}/embed.js?template=${template}`
document.body.appendChild(script)
},
isGitee() {
const origin = window.location.origin
if (origin.includes('gitee.io')) {
return true
}
return false
},
loadError(oError) {
this.loadSuccess = false
}
}
}
</script>
<style>
.cf-wrapper{
margin: 12px 0 0!important;
}
</style>

View File

@ -6,12 +6,14 @@
<navbar/>
<tags-view/>
<app-main/>
<AD/>
</div>
</div>
</template>
<script>
import { Navbar, Sidebar, AppMain, TagsView } from './components'
import AD from '@/components/AD'
import ResizeMixin from './mixin/ResizeHandler'
export default {
@ -20,7 +22,8 @@ export default {
Navbar,
Sidebar,
AppMain,
TagsView
TagsView,
AD
},
mixins: [ResizeMixin],
computed: {

View File

@ -25,7 +25,7 @@ export default {
<style scoped>
.app-main {
/*84 = navbar + tags-view = 50 +34 */
min-height: calc(100vh - 84px);
min-height: calc(100vh - 140px);
width: 100%;
position: relative;
overflow: hidden;