d2-container 组件不设置 filename 参数即可隐藏源码链接
Former-commit-id: 338635de840aae9203b9097994be6998599cd4a1 [formerly 338635de840aae9203b9097994be6998599cd4a1 [formerly 338635de840aae9203b9097994be6998599cd4a1 [formerly 338635de840aae9203b9097994be6998599cd4a1 [formerly 2a17e94a353d1c7e1990d53655341905df54349d [formerly 70a93514388cbf5fabe6c9d3f88b69f6037b0d54]]]]] Former-commit-id: 91e7e0d145fa2f23599bc2ecf7b727dcb60fe7be Former-commit-id: 0223929f7dbb93e27112eda97179ae372a473e54 Former-commit-id: 20a20907e97858ea20df71a00424a902aaad83c0 [formerly 5336d19ed968953a55fd557979445679ac091b53] Former-commit-id: efb2bb7697ef71df4bd76a189c3b3c12a8a251ac Former-commit-id: 5ba80c21cb95779ad7c89cc7eb97f9b43dc3f4c5 Former-commit-id: e7892e410b2e3624326e108df9ad83648516c282 Former-commit-id: 85ff8e9e8da8b771e0a6b46bb65adc5ec9bd1985 Former-commit-id: a034e3ae1e5bd188ef9858f6590fecf1178ae792
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
<template>
|
||||
<div
|
||||
v-if="active"
|
||||
class="d2-source"
|
||||
:class="{ 'd2-source--active': isActive }"
|
||||
@click="handleClick">
|
||||
@@ -21,6 +22,13 @@ export default {
|
||||
isActive: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
active () {
|
||||
return process.env.VUE_APP_BUILD_MODE === 'TRAVIS' ||
|
||||
process.env.NODE_ENV === 'development' &&
|
||||
this.filename
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
// 一秒后显示按钮
|
||||
setTimeout(() => {
|
||||
|
||||
@@ -54,10 +54,9 @@ export default {
|
||||
scroll: e => this.$emit('scroll', e)
|
||||
}
|
||||
}, slots),
|
||||
// 只在预览和开发模式下显示源码按钮
|
||||
process.env.VUE_APP_BUILD_MODE === 'TRAVIS' || process.env.NODE_ENV === 'development' ? h(d2Source, {
|
||||
h(d2Source, {
|
||||
props: this.$attrs
|
||||
}) : undefined
|
||||
})
|
||||
])
|
||||
},
|
||||
methods: {
|
||||
|
||||
Reference in New Issue
Block a user