Vue Learning notes vue--using HTML templates

Source: Internet
Author: User

When you create a Vue instance, el you can omit the option if the configuration item is declared template . At this point, Vue.js will extract the HTML content of the anchor element as a template.

We can use a single el configuration item to create a Vue instance:

var vm = new Vue({el:‘#app‘});

In Vue.js, this template is called an HTML template , and template a template written using a configuration item is called a string template .

Working principle

When Vue.js discovers that there are no attributes in the options you provide, the contents of the template el DOM node specified by the property are extracted outerHTML as template content. This is similar to the following:

var vm = New Vue ({ el:' #app ', Template: document.queryselector (' #app '). outerhtml}) /c4>

Vue Learning notes vue--using HTML templates

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.