🌐 AI搜索 & 代理 主页
Skip to content

Commit a79dadc

Browse files
authored
Update componentdoc.vue
1 parent 438aad4 commit a79dadc

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

docs/components/componentdoc.vue

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,13 @@
1616
</b-badge>
1717
</b-col>
1818
<b-col sm="3" class="text-sm-right">
19-
<b-btn variant="outline-secondary" size="sm" :href="githubURL" target="_blank">
19+
<b-btn
20+
v-if="githubURL"
21+
variant="outline-secondary"
22+
size="sm"
23+
:href="githubURL"
24+
target="_blank"
25+
>
2026
View source
2127
</b-btn>
2228
</b-col>
@@ -311,11 +317,12 @@ ul.component-ref-mini-toc:empty {
311317

312318
<script>
313319
import Vue from 'vue'
314-
import kebabCase from 'lodash/kebabCase'
315320
import AnchoredHeading from './anchored-heading'
316321
// Fallback descriptions for common props (mainly router-link props)
317322
import commonProps from '../common-props.json'
318323
324+
const const kebabCase = str => str.replace(/\B([A-Z])/g, '-$1').toLowerCase()
325+
319326
export default {
320327
name: 'BDVComponentdoc',
321328
components: { AnchoredHeading },
@@ -492,15 +499,19 @@ export default {
492499
return this.slots ? this.slots.map(s => ({ ...s })) : []
493500
},
494501
componentName() {
495-
return kebabCase(this.component)
502+
return kebabCase(this.component).replace('{', '-{')
496503
},
497504
tag() {
498505
return `<${this.componentName}>`
499506
},
500507
githubURL() {
508+
const name = this.componentName.replace(/^b-/, '')
509+
if (name.indexOf('{') !== -1)
510+
// Example compoent (most likely an auto generated component)
511+
return ''
512+
}
501513
const base = 'https://github.com/bootstrap-vue/bootstrap-vue/tree/dev/src/components'
502514
const slug = this.$route.params.slug
503-
const name = kebabCase(this.component).replace(/^b-/, '')
504515
// Always point to the .js file (which may import a .vue file)
505516
return `${base}/${slug}/${name}.js`
506517
}

0 commit comments

Comments
 (0)