Vue-cli and webpack in windows (3) use components and vue-cliwebpack

Source: Internet
Author: User

Vue-cli and webpack in windows (3) use components and vue-cliwebpack

1. This article is based on vue-cli and webpack for windows (I) Environment installation and vue-cli and webpack for windows (I) import the bootstrap style.

2. Create two components under the src \ components folder, namely header. vue and footer. vue. Open the header. vue file and paste the following code as the website header.

<Template> <! -- Fixed navbar --> <nav class = "navbar-inverse navbar-fixed-top" role = "navigation"> <div class = "container"> <div class = "navbar -header "> <button type =" button "class =" navbar-toggle collapsed "data-toggle =" collapse "data-target =" # navbar "aria-expanded =" false "aria-controls =" navbar "> <span class =" sr-only "> Toggle navigation </span> <span class =" icon-bar "> </span> <span class = "icon-bar"> </span> <spa N class = "icon-bar"> </span> </button> <a class = "navbar-brand" href = "#" rel = "external nofollow" rel =" external nofollow "rel =" external nofollow ">{{ msg }}</a> </div> <div id =" navbar "class =" navbar-collapse "> <ul class = "nav navbar-nav"> <li class = "active"> <a href = "/" rel = "external nofollow"> homepage </a> </li> <li> <a href = "/list" rel = "external nofollow"> Article </a> </li> <li class = "dropdown"> <a href = "# "Rel =" external nofollow "class =" dropdown-toggle "data-toggle =" dropdown "> member <span class =" caret "> </span> </a> <ul class =" dropdown-menu "role =" menu "> <li> <a href ="/user/login "rel = "external nofollow"> logon </a> </li> <a href = "/user/register" rel = "external nofollow"> Registration </a> </li> </ul> </div> <! --/. Nav-collapse --> </div> </nav> </template> <script> export default {name: 'header', data () {return {msg: 'logo '}}</script>

Open the footer. vue file and paste the following code as the bottom of the website:

<Template> <div class = "blog-footer"> <p> copyright piracy is required. </p> <a href = "#" rel = "external nofollow"> Back to top </a> </p> </div> </template>

Save

3. Open the app. vue file under the src folder and modify the template code

<template><div id="app"> <HtmlHeader></HtmlHeader> <div class="jumbotron">  

We can see that two newly created components are introduced in the Code and loaded into the template. After saving them, let's start the project.

The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.

Related Article

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.