What could be the reason for v-model not functioning properly within vue.extend?

I've configured a page structure similar to the following:

<main id="app">
  <div id="mount-place"></div>
</main>
<script type="text/x-template" id="my-template">
  ...some code here...
  <input type="text" v-model="address">
  ...some other code here...
</script>
<script>
var ExtendedElement = Vue.Extend({
  template: '#my-template',
  data: function() {
    return {
      address: {{ some_address|safe }};  // retrieves values from django
    }
  },
  mounted: function() {
    console.log(this.address);  // displays correctly
  }
});
new ExtendedElement().$mount('#mount-place');
</script>
...some irrelevant logic here...
<script>
const app = new Vue({
  delimiters: ['[[', ']]'],
  el: '#app'
});
</script>

Everything renders properly, but there seems to be an issue with the v-model as the input field is not displaying anything. However, when checking via the console, the values are present within the Vue object. No error messages are being shown.

Answer №1

The issue lies in the invocation of new Vue. The resolution involves removing the app variable and transferring the delimiters to the Vue.Extend function call.

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

utilize the getStaticProps function within the specified component

I recently started a project using Next.js and TypeScript. I have a main component that is called in the index.js page, where I use the getStaticProps function. However, when I log the prop object returned by getStaticProps in my main component, it shows a ...

What is the best way to design a regular expression that will only match up to 12 numbers?

Is there a way to construct a regular expression that will validate a string containing up to 12 digits only? Thank you! ...

Transform and command the data acquired through an AJAX request using jQuery

My code includes an AJAX call using jQuery: $('.add a').click(function() { $.ajax({ type: 'POST', url: '/api/fos', context: this, datatype: 'html', success: function(data) ...

Limiting the Size of Highcharts Maps with maxWidth or maxHeight

My attempt to adjust the maxWidth of my world map using highcharts isn't altering its size. I have experimented with the following: responsive: { rules: [{ condition: { maxWidth: 500 }, ... As recomme ...

Tips for preventing the caret (^) symbol from being added to a package when installing with yarn

Is there a way to prevent Yarn from adding the caret prefix to version numbers when installing packages like npm has for changing version prefix (https://docs.npmjs.com/misc/config#save-prefix)? I would like to apply this configuration only for the current ...

What could be causing my Vue component to not refresh?

Can anyone help me figure out why this component isn't re-rendering after changing the value? I'm attempting to create a dynamic filter similar to Amazon using only checkboxes. Here are the 4 components I have: App.vue, test-filter.vue, filtersIn ...

Is there a way to retrieve a data property in a Vue file's template without relying on props?

In my Laravel + Vue.js SPA (Single Page Application), I have implemented BootstrapVue and VeeValidate libraries. Within the EditProfile.vue component, I need to access the default_country_code data property from an attribute in the template with the same ...

What is the best way to update an array in TypeScript when the elements are of different types and the secondary array has a different type as

const usersData = [ { "id": 0, "name": "ABC" }, { "id": 1, "name": "XYZ" } ]; let dataList = []; // How can I transfer the data from the user array to the dataList array? // If I use the map function, do I need to initialize empty values for oth ...

Utilize jQuery and AJAX to refresh functions after each AJAX call for newly added items exclusively

I have encountered an issue with my jQuery plugins on my website. Everything functions smoothly until I load new elements via AJAX call. Re-initializing all the plugins then causes chaos because some are initialized multiple times. Is there a way to only i ...

Integrate a Nuxt project into an existing Express application

Is there a way to integrate a Nuxt project as middleware for an existing Express server while preserving SSR behavior? I've successfully transitioned my Vue application to Nuxt, but the nuxt-production-server is conflicting with my pre-existing serve ...

Instructions for rearranging the configuration of a 2D array?

A 2-dimensional array is created from a string called matrix: 131 673 234 103 018 201 096 342 965 150 630 803 746 422 111 537 699 497 121 956 805 732 524 037 331 After parsing, it becomes an array of arrays like this: [ [131, 673, 234, 103, 018], [2 ...

Fixing blurry text on canvas caused by Arbor.js mouse event issues

Currently, I am utilizing arborjs in my project. The text within the canvas is created using fillText in html5. While everything functions correctly on a Retina display MacBook, the text appears blurry. To address this, I applied the following solution: v ...

Struggling to find your way around the header on my website? Let me give

I'm looking to display certain links prominently at the top of a page, similar to this example: "home > page1 > link1 > article 1." Can someone advise on how to achieve this using HTML, PHP, or jQuery? ...

Enforce multiple npm modules to use a common dependency

Apologies for the beginner question, I am just starting out with npm and front end development. I have a library (A) that needs to be a singleton but requires initialization to pass start up configuration. Additionally, I have a library B which has libra ...

Tips for resolving the 'node-gyp rebuild' problem on Windows 10

While attempting to incorporate a node NPM dependency into my project, I encountered an issue with node-gyp rebuild, which I have already reported. I am aware of a potential solution from this Stack Overflow post, but unfortunately it is not effective for ...

Issue with JavaScript ScrollTop

Simply put, I am trying to determine the total scroll size for a text area in a unit that scrollTop can align with. However, I am at a loss on how to do so. I've tried scrollHeight and various other methods without success. Any advice or suggestions ...

Is there a way to get an iframe to mimic the behavior of other media elements within a horizontal scrolling container?

Take a look at this code snippet: $(document).ready(function() { $('.scrollable-area').on('wheel', function(e) { var scrollLeft = $(this).scrollLeft(); var width = $(this).get(0).scrollWidth - $(this).width(); var delta ...

Include additional data in the FormData object before sending it over AJAX requests

Currently, I am utilizing AJAX to store some data. The primary concern I have is figuring out how to incorporate additional information into the FormData object along with what I already have. Below is the function that I'm using. Could you assist me ...

What is the best way to eliminate the background color from one span after selecting a different one?

I created a span element that changes its background color when clicked, but I want the background color to switch to the newly clicked span while removing it from the previously clicked one. Can someone help me achieve this? CSS list-sty ...

Django's Approach to Parallel Processing

After receiving a file from the user and saving it, the next step is to analyze the file. Due to its size, the analysis process may take at least an hour. To keep track of the status of the analysis, the model includes a field indicating whether the analys ...