zoukankan      html  css  js  c++  java
  • 一个简单的完整的示范

    D:workspacexxxindex.html   没动过

    <!DOCTYPE html>
    <html>
      <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width,initial-scale=1.0">
        <title>xxx</title>
      </head>
      <body>
        <div id="app"></div>
        <!-- built files will be auto injected -->
      </body>
    </html>
    

      

    D:workspacexxxsrcmain.js

    import Vue from 'vue'
    import App from './App'
    import VueRouter from 'vue-router'
    import Apple from '@/components/Apple'
    import Banana from '@/components/Banana'
    
    Vue.use(VueRouter)
    
    let router = new VueRouter({
      routes: [
        {
          path: '/apple',
          component: Apple
        },
        {
          path: '/banana',
          component: Banana
        }
      ]
    })
    /* eslint-disable no-new */
    new Vue({
      el: '#app',
      router,
      template: '<App/>',
      components: { App }
    })
    

      

    D:workspacexxxsrcApp.vue

    <template>
      <div id="app">
        <img src="./assets/logo.png">
        <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>
    

      

    D:workspacexxxsrccomponentsApple.vue

    <template>
        <a >{{ msg }}</a>
    </template>
    
    <script>
    export default {
      name: 'Apple',
      data () {
        return {
          msg: 'I am an apple'
        }
      }
    }
    </script>
    

      

     D:workspacexxxsrccomponentsBanana.vue

    <template>
        <a >{{ msg }}</a>
    </template>
    
    <script>
    export default {
      name: 'Banana',
      data () {
        return {
          msg: 'I am a banana'
        }
      }
    }
    </script>
    

      

    效果

  • 相关阅读:
    gearman管理工具GearmanManager的安装与使用
    php使用gearman进行任务分发
    centos7下的FastDFS5.09的安装与使用
    centos7下的glusterfs的安装与使用
    centos7下keepalived1.3.4安装与使用
    centos7下haproxy1.7的使用与配置
    centos7下apache2.4反向代理
    centos7下Redis3的安装与使用
    php使用fputcsv进行大数据的导出
    php新增的一些特性
  • 原文地址:https://www.cnblogs.com/tabCtrlShift/p/9162612.html
Copyright © 2011-2022 走看看