9696 :items =" pluginImports"
9797 :fileds =" ['namedExport', 'importPath']"
9898 class =" bv-docs-table"
99- caption =" The plugin can be imported via several methods"
10099 responsive =" sm"
101100 head-variant =" default"
102101 caption-top
103102 bordered
104103 striped
105104 >
106- <template slot="[namedExport]" slot-scope="{ value, item }">
105+ <template slot="[namedExport]" slot-scope="{ value }">
107106 <code class =" text-nowrap notranslate" translate =" no" >{{ value }}</code >
108- <b-badge v-if =" item.legacy" variant =" warning" class =" small" >DEPRECATED</b-badge >
109- <b-badge v-else variant =" success" class =" small" >PREFERRED</b-badge >
110107 </template >
111108 <template slot="[importPath]" slot-scope="{ value }">
112109 <code class =" text-nowrap notranslate" translate =" no" >{{ value }}</code >
@@ -154,13 +151,17 @@ export default {
154151 meta: {}
155152 },
156153 computed: {
154+ importPath () {
155+ return ' bootstrap-vue'
156+ },
157157 isComponentRoute () {
158158 return this .$route .name === ' docs-components-slug'
159159 },
160160 pluginDir () {
161161 return this .$route .params .slug
162162 },
163163 pluginName () {
164+ // Directive plugin names are prefixed with `VB`
164165 const prefix = this .isComponentRoute ? ' ' : ' VB'
165166 return ` ${ prefix}${ startCase (this .pluginDir ).replace (/ \s + / g , ' ' )} Plugin`
166167 },
@@ -169,7 +170,7 @@ export default {
169170 return {
170171 component: this .componentTag (c),
171172 namedExport: c,
172- importPath: this .componentPath (c)
173+ importPath: this .importPath
173174 }
174175 })
175176 },
@@ -178,27 +179,15 @@ export default {
178179 return {
179180 directive: this .directiveAttr (d),
180181 namedExport: d,
181- importPath: this .directivePath (d)
182+ importPath: this .importPath
182183 }
183184 })
184185 },
185186 pluginImports () {
186- const pluginLocation = this .isComponentRoute ? ' components' : ' directives'
187- // const legacyName = this.pluginName.replace(/^VB|Plugin$/g, '')
188187 return [
189188 {
190189 namedExport: this .pluginName ,
191- importPath: ' bootstrap-vue'
192- },
193- {
194- namedExport: this .pluginName ,
195- importPath: ` bootstrap-vue/es/${ pluginLocation} ` ,
196- legacy: true
197- },
198- {
199- namedExport: ' default' ,
200- importPath: ` bootstrap-vue/es/${ pluginLocation} /${ this .pluginDir } ` ,
201- legacy: true
190+ importPath: this .importPath
202191 }
203192 ]
204193 },
@@ -231,10 +220,7 @@ export default {
231220 ].join (' \n ' )
232221 },
233222 pluginImportCode () {
234- // const pluginLocation = this.isComponentRoute ? 'components' : 'directives'
235223 return [
236- ' // Importing the named export' ,
237- // `import { ${this.pluginName} } from 'bootstrap-vue/es/${pluginLocation}'`,
238224 ` import { ${ this .pluginName } } from 'bootstrap-vue'` ,
239225 ` Vue.use(${ this .pluginName } )`
240226 ].join (' \n ' )
@@ -253,23 +239,13 @@ export default {
253239 componentTag (component ) {
254240 return ` <${ this .componentName (component)} >`
255241 },
256- componentPath (component ) {
257- // const componentName = this.componentName(component).replace(/^b-/, '')
258- // return `bootstrap-vue/es/components/${this.pluginDir}/${componentName}`
259- return ' bootstrap-vue'
260- },
261242 directiveName (directive ) {
262243 return kebabCase (directive)
263244 .replace (/ ^ v-/ , ' ' )
264245 .replace (/ ^ vb-/ , ' b-' )
265246 },
266247 directiveAttr (directive ) {
267248 return kebabCase (directive).replace (/ ^ vb-/ , ' v-b-' )
268- },
269- directivePath (directive ) {
270- // const directiveName = this.directiveName(directive).replace(/^b-/, '')
271- // return `bootstrap-vue/es/directives/${directiveName}/${directiveName}`
272- return ' bootstrap-vue'
273249 }
274250 }
275251}
0 commit comments