zMouse 8 лет назад
Родитель
Сommit
ec9644871f
7 измененных файлов с 54 добавлено и 71 удалено
  1. 6 0
      build/webpack.dev.conf.js
  2. 1 0
      index.html
  3. 5 1
      package.json
  4. 28 14
      src/App.vue
  5. 0 53
      src/components/Hello.vue
  6. 11 0
      src/components/Main.vue
  7. 3 3
      src/router/index.js

+ 6 - 0
build/webpack.dev.conf.js

@@ -6,6 +6,12 @@ var baseWebpackConfig = require('./webpack.base.conf')
 var HtmlWebpackPlugin = require('html-webpack-plugin')
 var FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
 
+const vuxLoader = require('vux-loader')
+
+baseWebpackConfig = vuxLoader.merge(baseWebpackConfig, {
+  plugins: ['vux-ui']
+})
+
 // add hot-reload related code to entry chunks
 Object.keys(baseWebpackConfig.entry).forEach(function (name) {
   baseWebpackConfig.entry[name] = ['./build/dev-client'].concat(baseWebpackConfig.entry[name])

+ 1 - 0
index.html

@@ -2,6 +2,7 @@
 <html>
   <head>
     <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
     <title>163</title>
   </head>
   <body>

+ 5 - 1
package.json

@@ -10,8 +10,12 @@
     "build": "node build/build.js"
   },
   "dependencies": {
+    "less": "^2.7.2",
+    "less-loader": "^4.0.4",
     "vue": "^2.3.3",
-    "vue-router": "^2.3.1"
+    "vue-router": "^2.3.1",
+    "vux": "^2.4.1",
+    "vux-loader": "^1.1.0"
   },
   "devDependencies": {
     "autoprefixer": "^6.7.2",

+ 28 - 14
src/App.vue

@@ -1,23 +1,37 @@
 <template>
-  <div id="app">
-    <img src="./assets/logo.png">
-    <router-view></router-view>
-  </div>
+    <div id="app">
+        <x-header>
+            <div slot="overwrite-left">直播</div>
+            <div>网易</div>
+            <div slot="right">搜索</div>
+        </x-header>
+
+        <tab active-color="red">
+            <tab-item selected>头条</tab-item>
+            <tab-item>娱乐</tab-item>
+            <tab-item>体育</tab-item>
+            <tab-item>网易号</tab-item>
+            <tab-item>北京</tab-item>
+            <tab-item>上海</tab-item>
+        </tab>
+
+        <router-view></router-view>
+    </div>
 </template>
 
 <script>
+import { XHeader, Tab, TabItem } from 'vux';
+
 export default {
-  name: 'app'
+    name: 'app',
+    components: {
+        XHeader,
+        Tab,
+        TabItem
+    }
 }
 </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 lang="less">
+@import '~vux/src/styles/reset.less';
 </style>

+ 0 - 53
src/components/Hello.vue

@@ -1,53 +0,0 @@
-<template>
-  <div class="hello">
-    <h1>{{ msg }}</h1>
-    <h2>Essential Links</h2>
-    <ul>
-      <li><a href="https://vuejs.org" target="_blank">Core Docs</a></li>
-      <li><a href="https://forum.vuejs.org" target="_blank">Forum</a></li>
-      <li><a href="https://gitter.im/vuejs/vue" target="_blank">Gitter Chat</a></li>
-      <li><a href="https://twitter.com/vuejs" target="_blank">Twitter</a></li>
-      <br>
-      <li><a href="http://vuejs-templates.github.io/webpack/" target="_blank">Docs for This Template</a></li>
-    </ul>
-    <h2>Ecosystem</h2>
-    <ul>
-      <li><a href="http://router.vuejs.org/" target="_blank">vue-router</a></li>
-      <li><a href="http://vuex.vuejs.org/" target="_blank">vuex</a></li>
-      <li><a href="http://vue-loader.vuejs.org/" target="_blank">vue-loader</a></li>
-      <li><a href="https://github.com/vuejs/awesome-vue" target="_blank">awesome-vue</a></li>
-    </ul>
-  </div>
-</template>
-
-<script>
-export default {
-  name: 'hello',
-  data () {
-    return {
-      msg: 'Welcome to Your Vue.js App'
-    }
-  }
-}
-</script>
-
-<!-- Add "scoped" attribute to limit CSS to this component only -->
-<style scoped>
-h1, h2 {
-  font-weight: normal;
-}
-
-ul {
-  list-style-type: none;
-  padding: 0;
-}
-
-li {
-  display: inline-block;
-  margin: 0 10px;
-}
-
-a {
-  color: #42b983;
-}
-</style>

+ 11 - 0
src/components/Main.vue

@@ -0,0 +1,11 @@
+<template>
+    <div class="hello">
+
+    </div>
+</template>
+
+<script>
+export default {
+    name: 'Main'
+}
+</script>

+ 3 - 3
src/router/index.js

@@ -1,6 +1,6 @@
 import Vue from 'vue'
 import Router from 'vue-router'
-import Hello from '@/components/Hello'
+import Main from '@/components/Main'
 
 Vue.use(Router)
 
@@ -8,8 +8,8 @@ export default new Router({
   routes: [
     {
       path: '/',
-      name: 'Hello',
-      component: Hello
+      name: 'Main',
+      component: Main
     }
   ]
 })