Commit 099f86c4 authored by hanfeng zhang's avatar hanfeng zhang

123

parent fe9e7a4e
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -23,8 +23,11 @@ ...@@ -23,8 +23,11 @@
"@vue/cli-plugin-vuex": "~4.5.0", "@vue/cli-plugin-vuex": "~4.5.0",
"@vue/cli-service": "~4.5.0", "@vue/cli-service": "~4.5.0",
"@vue/eslint-config-typescript": "^7.0.0", "@vue/eslint-config-typescript": "^7.0.0",
"autoprefixer": "^9.8.6",
"eslint": "^6.7.2", "eslint": "^6.7.2",
"eslint-plugin-vue": "^6.2.2", "eslint-plugin-vue": "^6.2.2",
"postcss": "^7.0.35",
"tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.1.2",
"typescript": "~4.1.5", "typescript": "~4.1.5",
"vue-template-compiler": "^2.6.11" "vue-template-compiler": "^2.6.11"
} }
......
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
}
}
\ No newline at end of file
<template> <template>
<div id="app"> <div id="app">
<div id="nav"> <router-view></router-view>
<router-link to="/">Home</router-link> |
<router-link to="/about">About</router-link>
</div>
<router-view/>
</div> </div>
</template> </template>
<script lang="ts">
import Vue from 'vue';
<style> export default Vue.extend({
#app { name: 'Home',
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
}
#nav { });
padding: 30px; </script>
}
#nav a {
font-weight: bold;
color: #2c3e50;
}
#nav a.router-link-exact-active {
color: #42b983;
}
</style>
// 静态数据的存放地址
\ No newline at end of file
<template>
<div class="Layout">
<!-- <header>header</header> -->
<div class='content'>
<slot>
<router-view></router-view>
</slot>
</div>
<!-- <footer>mxmwebsite</footer> -->
</div>
</template>
<script lang="ts">
import Vue from 'vue';
export default Vue.extend({
name: 'Layout'
});
</script>
...@@ -2,9 +2,40 @@ import Vue from 'vue' ...@@ -2,9 +2,40 @@ import Vue from 'vue'
import App from './App.vue' import App from './App.vue'
import router from './router' import router from './router'
import store from './store' import store from './store'
import './style.css'
Vue.config.productionTip = false Vue.config.productionTip = false
const overscroll = function(el:any) {
el.addEventListener('touchstart', function() {
const top = el.scrollTop
, totalScroll = el.scrollHeight
, currentScroll = top + el.offsetHeight;
//If we're at the top or the bottom of the containers
//scroll, push up or down one pixel.
//
//this prevents the scroll from "passing through" to
//the body.
if(top === 0) {
el.scrollTop = 1;
} else if(currentScroll === totalScroll) {
el.scrollTop = top - 1;
}
});
el.addEventListener('touchmove', function(evt:any) {
//if the content is actually scrollable, i.e. the content is long enough
//that scrolling can occur
if(el.offsetHeight < el.scrollHeight)
evt._isScroller = true;
});
}
overscroll(document.querySelector('.scroll'));
document.body.addEventListener('touchmove', function(evt:any) {
//In this case, the default behavior is scrolling the body, which
//would result in an overflow. Since we don't want that, we preventDefault.
if(!evt._isScroller) {
evt.preventDefault();
}
});
new Vue({ new Vue({
router, router,
store, store,
......
import Vue from 'vue' import Vue from 'vue'
import VueRouter, { RouteConfig } from 'vue-router' import VueRouter, { RouteConfig } from 'vue-router'
import Home from '../views/Home.vue' import ModeOne from '../layouts/index.vue'
Vue.use(VueRouter) Vue.use(VueRouter)
const routes: Array<RouteConfig> = [ const routes: Array<RouteConfig> = [
{ {
path: '/', path: '/',
name: 'Home', name: 'Enter',
component: Home component: ModeOne,
}, redirect:'/welcome',
{ children:[
path: '/about', {
name: 'About', path: '/welcome',
// route level code-splitting name: 'Home',
// this generates a separate chunk (about.[hash].js) for this route component: ()=>import('@/views/Home.vue')
// which is lazy-loaded when the route is visited. }
component: () => import(/* webpackChunkName: "about" */ '../views/About.vue') ]
} }
] ]
......
接口的统一出口文件
\ No newline at end of file
@tailwind base;
@tailwind components;
@tailwind utilities;
body,
html{
position: fixed;
}
\ No newline at end of file
<template> <template>
<div class="home"> <div class="home relative overflow-scroll">
<img alt="Vue logo" src="../assets/logo.png"> <div class='page bg-red-600'></div>
<HelloWorld msg="Welcome to Your Vue.js + TypeScript App"/> <div class='page bg-blue-600'></div>
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts">
import Vue from 'vue'; import Vue from 'vue';
import HelloWorld from '@/components/HelloWorld.vue'; // @ is an alias to /src
export default Vue.extend({ export default Vue.extend({
name: 'Home', name: 'Home',
components: {
HelloWorld,
},
}); });
</script> </script>
<style scoped>
.page{
height: 100vh;
width: 100vw;
}
</style>
\ No newline at end of file
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment