Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

IE11 JS error under vue-bootstrap-pagination@2.10.3 #20

Open
caffme opened this issue Jul 7, 2017 · 1 comment
Open

IE11 JS error under vue-bootstrap-pagination@2.10.3 #20

caffme opened this issue Jul 7, 2017 · 1 comment

Comments

@caffme
Copy link

caffme commented Jul 7, 2017

I am seeing this error in IE11 when building my project with webpack (via laravel mix) using the new built 2.10.3 version:

[Vue warn]: Error in render function: "TypeError: Object doesn't support property or method 'assign'"

I believe it is this section of code:

...
    config: function config() {
      return Object.assign({
        offset: 3,
...

See:
https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign#Browser_compatibility

The changes from 2.10.2 to 2.10.3 did fix the previous IE11 error related to template strings: #16 ( 'Invalid character' on the open backtick ` ) for me.

@caffme caffme mentioned this issue Jul 7, 2017
@Neoglyph
Copy link
Member

Neoglyph commented Jul 7, 2017

Greetings,

already implemented the fix, will be pushed to the repo shortly.
Until then, I recommend you use this polyfill at the start of your javascript, which will fix your Object.assign error.

// IE - Object assign polyfill
if (typeof Object.assign != 'function') {
  Object.assign = function(target, varArgs) { // .length of function is 2
    'use strict';
    if (target == null) { // TypeError if undefined or null
      throw new TypeError('Cannot convert undefined or null to object');
    }

    var to = Object(target);

    for (var index = 1; index < arguments.length; index++) {
      var nextSource = arguments[index];

      if (nextSource != null) { // Skip over if undefined or null
        for (var nextKey in nextSource) {
          // Avoid bugs when hasOwnProperty is shadowed
          if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
            to[nextKey] = nextSource[nextKey];
          }
        }
      }
    }
    return to;
  };
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants