Encounter issues with v-for functionality when using Internet Explorer 11

I am facing an issue with the rendering of a table in a simple Vue instance. The document displays correctly on Firefox and Chrome, however, I encounter an error in IE11:

[Vue warn]: Error when rendering root instance.

I assumed that Vue is compatible with 'modern browsers', but I couldn't find any compatibility information in the Vue documentation.

Do you have any suggestions on how to resolve this problem?

        // initialization
        var notesView = new Vue({
            el: '#demo',
            data: {
                notes: []
            },
            methods: {
            }
        });

notesView.notes = JSON.parse('[{"noteTime":"2018-07-30T22:00:00.000Z","locationName":"Q3000010","noteText":"NoteText0"},{"noteTime":"2018-07-31T22:00:00.000Z","locationName":"Q3000020","noteText":"NoteText1"}]');
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.16/vue.js"></script>
<div id="demo">
  <div v-if="notes.length > 0">
    <table class="table table-bordered">
      <tbody>
        <template v-for="(note,index) in notes">
          <tr class="condensed" :class="index % 2 === 0 ? 'odd' : ''">
            <td width="150px">
              {{ note.noteTime }}
            </td>
            <td>
              {{ note.locationName }}
            </td>
          </tr>
          <tr :class="index % 2 === 0 ? 'odd' : ''">
            <td colspan="2">
              {{ note.noteText }}
            </td>
          </tr>
        </template>
      </tbody>
    </table>
  </div>
  <div v-else="">
    <div class="alert alert-warning" role="alert">
      There are no notes here yet...
    </div>
  </div>
</div>

Answer №1

My solution involved utilizing the x-template script to overcome the limitations of IE11, which led to some compromises in code readability and necessitated special attention for IE...

// setting up the grid control
        var notesView = new Vue({
            el: '#notes',
            template: '#v-notes-view',
            data: {
                notes: []
            },
            methods: {
            }
        });

notesView.notes = JSON.parse('[{"noteTime":"2018-07-30T22:00:00.000Z","locationName":"Q3000010","noteText":"NoteText0"},{"noteTime":"2018-07-31T22:00:00.000Z","locationName":"Q3000020","noteText":"NoteText1"}]');
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.16/vue.js"></script>
<div id="notes">
</div>
<script type="text/x-template" id="v-notes-view">
<div v-if="notes.length > 0">
  <table class="table table-bordered">
    <tbody>
      <template v-for="(note,index) in notes">
        <tr class="condensed" :class="index % 2 === 0 ? 'odd' : ''">
          <td width="150px">
            {{ note.noteTime }}
          </td>
          <td>
            {{ note.locationName }}
          </td>
        </tr>
        <tr :class="index % 2 === 0 ? 'odd' : ''">
          <td colspan="2">
            {{ note.noteText }}
          </td>
        </tr>
      </template>
    </tbody>
  </table>
</div>
<div v-else="">
  <div class="alert alert-warning" role="alert">
    There are no notes here yet...
  </div>
</div>
</script>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Toggling the form's value to true upon displaying the popup

I have developed an HTML page that handles the creation of new users on my website. Once a user is successfully created, I want to display a pop-up message confirming their creation. Although everything works fine, I had to add the attribute "onsubmit= re ...

Transferring Python Data to JavaScript using Django

Currently, I am utilizing Django and Apache for webpage serving purposes. In my JavaScript code, I have a data object that contains values to be exhibited in HTML widgets based on the user's selection from a menu. I am looking for a way to derive this ...

Vue.js error: Unable to locate requested resources

Recently, I've been encountering a curious issue when trying to access a specific component in my application. When I manually type the URL http://localhost:8080/detailed-support/start into the browser, the content loads without error. However, none o ...

Zebra lines overlooking unseen details

Imagine having a table where rows can be dynamically assigned classes such as .hidden, which hide those rows using CSS. The rows are styled with alternating colors, like this: tr:nth-child(even) { background-color: $light-grey; } But here's the ...

Extracting specific keys from JSON data

I am working with an array named cols: var cols = ["ticker", "highPrice", "lowPrice","lastPrice"] // dynamic The JSON data is coming from the backend as: info = {ticker: "AAPL", marketCap: 2800000000, lowPrice: 42.72, highPrice: 42.84} If I want to sel ...

Working with Vue's v-for directive to bind computed properties

I am inputting a set of tasks into my v-form tasks: [ { title: 'title1', description: 'task 1 description', isComplete: functionA() }, { title: 'title2', ...

Using the `map()` method in React's array

I stumbled upon an interesting example at http://codepen.io/lacker/pen/vXpAgj that closely resembles my current issue. Let's consider the following array: [ {category: 'Sporting Goods', price: '$49.99', stocked: true, name: &apo ...

What is the best way to send AJAX post data to a Node.js server?

I am currently facing an issue with passing a unique ID object back to the server side using Ajax after making an API call. I need help figuring out what might be going wrong in my code. This is the client side code snippet where I loop through a JavaScri ...

Two tags attached to four hypertext links

Within my HTML code, I have hyperlinks present on every line. However, I am seeking to eliminate these hyperlinks specifically from "your previous balance" and "your new balance". In the following HTML snippet: <tr *ngFor="let l of statementLines; ...

Having difficulty aligning ListItem to the right within a List

I am working with an array that contains objects which I need to display in ListItems of a List. My goal is to show these ListItems from the array Objects in a layout where odd numbers are on the left and even numbers are on the right. However, I am facing ...

Retrieve the PDF document from the AJAX call and save it as a

My goal is to have the browser automatically download a PDF file that is received from an AJAX response. After reading about how to download a PDF file using jQuery AJAX, I attempted to simulate a click/download event in this way: var req = new XMLHt ...

Removing the gridlines in a Linechart using Apexcharts

I am experiencing issues with the grid and Nodata options on my Apexchart line chart. noData: { text: none , align: 'center', verticalAlign: 'middle', offsetX: 0, offsetY: 0, style: { color: undefined, fontSize: &apo ...

Opting for "npm ci" over "npm install" for ensuring a consistent project setup

When working on a project where the package-lock.json is managed in source control to ensure consistency among all developers, there may be confusion surrounding the use of npm ci versus npm install. According to npm documentation, developers should utili ...

Using Vuetify to create subtle fade in animation when scrolling

I'm attempting to create a fade-in effect while scrolling through the page for the first time. Even though I used <v-scroll-x-transition appear>, the desired effect doesn't seem to be working. Instead of fading in from the right as expecte ...

"Implementing a feature in Django that clears the input field upon clicking the clear button

I am working on a Django HTML file that includes an input field and a clear button. I need to clear the input field when the clear button is pressed. Is it necessary to use JavaScript for this task, or is there another way to achieve it? <form> ...

Can webpack effectively operate in both the frontend and backend environments?

According to the information provided on their website, packaging is defined as: webpack serves as a module bundler with its main purpose being to bundle JavaScript files for usage in a browser. Additionally, it has the ability to transform, bundle, or ...

The order of CSS precedence shifts even when the class sequence is the same

In my development setup, I have a react component that is embedded within two distinct applications each with their own webpack configurations. Within the component, I am utilizing a FontAwesome icon using the react-fontawesome library: <FontAwesom ...

Unable to fetch permissions for user:email via GitHub API

Currently, I am utilizing node-fetch to fetch an OAuth2 token from an OAuth2 GitHub App. The obtained token allows me to successfully retrieve user information from "https://api.github.com/user". However, I also require the email address, which necessitate ...

Validation with vee-validate performed instantly after inputting every character

Is it possible to validate after each input character instead of only upon clicking somewhere? Please enter your password: <div class='form-group' :class='{"form-group_invalid": errors.has("password") && error ...

Guide to verifying the presence of cookies by name in the browser and granting access to the specific page accordingly

In the process of developing an authorization system with Express, Node, and MySQL, I decided to utilize JWT tokens for user authorization. After successfully storing the JWT token in cookies, my next step is to verify if the token exists in the cookie b ...