|
16 | 16 | </b-badge> |
17 | 17 | </b-col> |
18 | 18 | <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 | + > |
20 | 26 | View source |
21 | 27 | </b-btn> |
22 | 28 | </b-col> |
@@ -311,11 +317,12 @@ ul.component-ref-mini-toc:empty { |
311 | 317 |
|
312 | 318 | <script> |
313 | 319 | import Vue from 'vue' |
314 | | -import kebabCase from 'lodash/kebabCase' |
315 | 320 | import AnchoredHeading from './anchored-heading' |
316 | 321 | // Fallback descriptions for common props (mainly router-link props) |
317 | 322 | import commonProps from '../common-props.json' |
318 | 323 |
|
| 324 | +const const kebabCase = str => str.replace(/\B([A-Z])/g, '-$1').toLowerCase() |
| 325 | +
|
319 | 326 | export default { |
320 | 327 | name: 'BDVComponentdoc', |
321 | 328 | components: { AnchoredHeading }, |
@@ -492,15 +499,19 @@ export default { |
492 | 499 | return this.slots ? this.slots.map(s => ({ ...s })) : [] |
493 | 500 | }, |
494 | 501 | componentName() { |
495 | | - return kebabCase(this.component) |
| 502 | + return kebabCase(this.component).replace('{', '-{') |
496 | 503 | }, |
497 | 504 | tag() { |
498 | 505 | return `<${this.componentName}>` |
499 | 506 | }, |
500 | 507 | 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 | + } |
501 | 513 | const base = 'https://github.com/bootstrap-vue/bootstrap-vue/tree/dev/src/components' |
502 | 514 | const slug = this.$route.params.slug |
503 | | - const name = kebabCase(this.component).replace(/^b-/, '') |
504 | 515 | // Always point to the .js file (which may import a .vue file) |
505 | 516 | return `${base}/${slug}/${name}.js` |
506 | 517 | } |
|
0 commit comments