Baozhangchao 3 年之前
父節點
當前提交
418d7f9982

+ 4
- 0
build/webpack.base.conf.js 查看文件

@@ -46,6 +46,10 @@ module.exports = {
46 46
         loader: 'vue-loader',
47 47
         options: vueLoaderConfig
48 48
       },
49
+      {
50
+        test: /\.scss$/,
51
+        loaders: ['style', 'css', 'sass']
52
+      },
49 53
       {
50 54
         test: /\.js$/,
51 55
         loader: 'babel-loader',

+ 12798
- 0
package-lock.json
文件差異過大導致無法顯示
查看文件


+ 4
- 0
package.json 查看文件

@@ -44,8 +44,12 @@
44 44
     "postcss-loader": "^2.0.8",
45 45
     "postcss-url": "^7.2.1",
46 46
     "rimraf": "^2.6.0",
47
+    "sass": "^1.49.7",
48
+    "sass-loader": "^7.3.1",
47 49
     "semver": "^5.3.0",
48 50
     "shelljs": "^0.7.6",
51
+    "style-loader": "^3.3.1",
52
+    "swiper": "^8.0.5",
49 53
     "uglifyjs-webpack-plugin": "^1.1.1",
50 54
     "url-loader": "^0.5.8",
51 55
     "vue-loader": "^13.3.0",

+ 1
- 12
src/App.vue 查看文件

@@ -1,7 +1,6 @@
1 1
 <template>
2 2
   <div id="app">
3
-    <img src="./assets/logo.png">
4
-    <router-view/>
3
+    <router-view />
5 4
   </div>
6 5
 </template>
7 6
 
@@ -11,13 +10,3 @@ export default {
11 10
 }
12 11
 </script>
13 12
 
14
-<style>
15
-#app {
16
-  font-family: 'Avenir', Helvetica, Arial, sans-serif;
17
-  -webkit-font-smoothing: antialiased;
18
-  -moz-osx-font-smoothing: grayscale;
19
-  text-align: center;
20
-  color: #2c3e50;
21
-  margin-top: 60px;
22
-}
23
-</style>

二進制
src/assets/index/1.jpg 查看文件


二進制
src/assets/index/点击开启.png 查看文件


+ 43
- 0
src/components/Swiper/index.vue 查看文件

@@ -0,0 +1,43 @@
1
+<template>
2
+  <div class="swiper-container">
3
+    <div class="swiper-wrapper">
4
+      <slot></slot>
5
+    </div>
6
+    <slot name="pagination"></slot>
7
+  </div>
8
+</template>
9
+
10
+<script>
11
+import Swiper from 'swiper'
12
+// import SwiperCore, { Autoplay, Pagination } from 'swiper/core'
13
+
14
+// SwiperCore.use([Autoplay, Pagination])
15
+
16
+export default {
17
+  name: 'Swiper',
18
+  props: {
19
+    options: {
20
+      type: Object,
21
+      default: () => ({})
22
+    }
23
+  },
24
+  data() {
25
+    return {
26
+      swiper: undefined
27
+    }
28
+  },
29
+  mounted() {
30
+    this.$nextTick(() => {
31
+      this.swiper = new Swiper(this.$el, this.options)
32
+      this.$emit('inited', this.swiper)
33
+    })
34
+  }
35
+}
36
+</script>
37
+
38
+<style>
39
+.swiper-container {
40
+  width: 100%;
41
+  height: 100%;
42
+}
43
+</style>

+ 32
- 0
src/components/SwiperSlide/index.vue 查看文件

@@ -0,0 +1,32 @@
1
+<template>
2
+  <div class="swiper-slide">
3
+    <slot></slot>
4
+  </div>
5
+</template>
6
+
7
+<script>
8
+export default {
9
+  name: 'SwiperSlide'
10
+}
11
+</script>
12
+
13
+<style>
14
+.swiper-slide {
15
+  text-align: center;
16
+  background: #fff;
17
+
18
+  /* Center slide text vertically */
19
+  display: -webkit-box;
20
+  display: -ms-flexbox;
21
+  display: -webkit-flex;
22
+  display: flex;
23
+  -webkit-box-pack: center;
24
+  -ms-flex-pack: center;
25
+  -webkit-justify-content: center;
26
+  justify-content: center;
27
+  -webkit-box-align: center;
28
+  -ms-flex-align: center;
29
+  -webkit-align-items: center;
30
+  align-items: center;
31
+}
32
+</style>

+ 13
- 0
src/layouts/index.vue 查看文件

@@ -0,0 +1,13 @@
1
+<template>
2
+  <router-view></router-view>
3
+</template>
4
+
5
+<script>
6
+
7
+export default {
8
+  name: 'AppLayout',
9
+  data() {
10
+    return {}
11
+  }
12
+}
13
+</script>

+ 4
- 1
src/main.js 查看文件

@@ -3,9 +3,12 @@
3 3
 import Vue from 'vue'
4 4
 import App from './App'
5 5
 import router from './router'
6
+import Swiper from './components/Swiper'
7
+import SwiperSlide from './components/SwiperSlide'
6 8
 
7 9
 Vue.config.productionTip = false
8
-
10
+Vue.component('swiper', Swiper)
11
+Vue.component('swiper-slide', SwiperSlide)
9 12
 /* eslint-disable no-new */
10 13
 new Vue({
11 14
   el: '#app',

+ 113
- 0
src/pages/IndexImage.vue
文件差異過大導致無法顯示
查看文件


+ 17
- 0
src/pages/index.vue 查看文件

@@ -0,0 +1,17 @@
1
+<template>
2
+  <div>
3
+    <h1>aaaaaaaaaaaaaaaa</h1>
4
+    <index-image></index-image>
5
+  </div>
6
+</template>
7
+
8
+<script>
9
+export default {
10
+  components: {
11
+    IndexImage: () => import('./IndexImage.vue')
12
+  }
13
+}
14
+</script>
15
+
16
+<style>
17
+</style>

+ 3
- 3
src/router/index.js 查看文件

@@ -1,6 +1,6 @@
1 1
 import Vue from 'vue'
2 2
 import Router from 'vue-router'
3
-import HelloWorld from '@/components/HelloWorld'
3
+import ColmoIndex from '@/pages'
4 4
 
5 5
 Vue.use(Router)
6 6
 
@@ -8,8 +8,8 @@ export default new Router({
8 8
   routes: [
9 9
     {
10 10
       path: '/',
11
-      name: 'HelloWorld',
12
-      component: HelloWorld
11
+      name: 'ColmoIndex',
12
+      component: ColmoIndex
13 13
     }
14 14
   ]
15 15
 })