bootstrap-vue
Version:
BootstrapVue provides one of the most comprehensive implementations of Bootstrap 4 components and grid system for Vue.js and with extensive and automated WAI-ARIA accessibility markup.
32 lines (30 loc) • 675 B
JavaScript
/*
* SSR Safe Client Side ID attribute generation
*
*/
export default {
props: {
id: {
type: String,
default: null
}
},
methods: {
safeId: function safeId() {
var suffix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
var id = this.id || this.localId_ || null;
if (!id) {
return null;
}
suffix = String(suffix).replace(/\s+/g, '_');
return suffix ? id + '_' + suffix : id;
}
},
computed: {
localId_: function localId_() {
if (!this.$isServer && !this.id && typeof this._uid !== 'undefined') {
return '__BVID__' + this._uid;
}
}
}
};