6. vue.js-饿了吗全套-项目运行.

来源:互联网 发布:金知云林秀晶 编辑:程序博客网 时间:2024/06/01 08:47

构建项目

  1. 项目入口(index.html)
<!DOCTYPE html><html>  <head>    <meta charset="utf-8">    <title>sell</title>  </head>  <body>    <div id="app"></div>    <!-- built files will be auto injected -->  </body></html>   

备注:
id = “app”

  1. js解析入口
    src/main.js
// The Vue build version to load with the `import` command// (runtime-only or standalone) has been set in webpack.base.conf with an alias.import Vue from 'vue' //导入vue 信息import App from './App'  //导入自定义App.vue文件import router from './router'  //导入路由Vue.config.productionTip = false/* eslint-disable no-new */new Vue({  el: '#app',  //绑定vue的作用域  router,  //使用的路由  template: '<App/>',  //模板  components: { App }  //组件})
  1. 组件文件 App.vue
<template>  <div id="app">    <img src="./assets/logo.png">    <router-view></router-view>  </div></template><script>export default {  name: 'app'}</script><style>#app {  font-family: 'Avenir', Helvetica, Arial, sans-serif;  -webkit-font-smoothing: antialiased;  -moz-osx-font-smoothing: grayscale;  text-align: center;  color: #2c3e50;  margin-top: 60px;}</style>

组件 ,

原创粉丝点击