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.