NightCatSama/vue-slider-component

ReferenceError: navigator is not defined

narasimharaosp opened this issue · 1 comments

Added the vue-slider-component via yarn to nuxt project.

Error 1: ReferenceError: navigator is not defined

Where:
./node_modules/vue-range-component/dist/vue-range-slider.js:20
var userAgentInfo = navigator.userAgent.toLowerCase();

Solution:
if (typeof navigator === 'undefined') return false
var userAgentInfo = navigator.userAgent.toLowerCase();

Error 2: ReferenceError: document is not defined

Where:
./node_modules/vue-range-component/dist/vue-range-slider.js:51
var elementStyle = document.createElement('div').style;

Solution:
var elementStyle = (typeof document !== 'undefined') ? document.createElement('div').style : null;

if (elementStyle !== null) {
for (var key in transformNames) {
if (elementStyle[transformNames[key]] !== undefined) {
return key;
}
}
}

The error is reported for this repository 😃 https://github.com/xwpongithub/vue-range-slider