Commit b40458fa authored by huanglu's avatar huanglu

update template

parent 5985e448
<template>
<div id="app">
<div id="nav">
<!-- 测试mock数据 get请求 -->
<h1><a href="/userinfo">useinfo</a></h1>
<h1><a href="/hello">useinfo</a></h1>
<button @click="changeName('kk')">changeaccount</button>
<router-link to="/">Home</router-link>
<router-link to="/cart">About</router-link>
</div>
<keep-alive>
<router-view v-if="$route.meta.keepAlive"/>
</keep-alive>
<router-view v-if="!$route.meta.keepAlive"/>
</div>
</template>
<script>
export default {
mounted() {
},
methods: {
},
};
</script>
<style lang="less" scoped>
</style>
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<p>
For a guide and recipes on how to configure / customize this project,<br>
check out the
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
</p>
<h3>Installed CLI Plugins</h3>
<ul>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-router" target="_blank" rel="noopener">router</a></li>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-vuex" target="_blank" rel="noopener">vuex</a></li>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint" target="_blank" rel="noopener">eslint</a></li>
</ul>
<h3>Essential Links</h3>
<ul>
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
</ul>
<h3>Ecosystem</h3>
<ul>
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
</ul>
</div>
</template>
<script>
export default {
name: 'HelloWorld',
props: {
msg: String,
},
};
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="less">
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>
<template> <template>
<div>this si hello page</div> <span>全局组件</span>
</template> </template>
<script> <script>
export default { export default {
......
import Vue from 'vue';
import App from './App.vue';
Vue.config.productionTip = false;
new Vue({
render: (h) => h(App),
}).$mount('#app');
\ No newline at end of file
<template> <template>
<div id="app"> <div id="app">
this is home this is home
<router-link to='Cart'>cart</router-link>
<keep-alive> <keep-alive>
<router-view v-if="$route.meta.keepAlive"/> <router-view v-if="$route.meta.keepAlive"/>
</keep-alive> </keep-alive>
......
<template>
<div class="hello">
this is helloworld components
</div>
</template>
<script>
export default {
name: 'HelloWorld',
props: {
msg: String,
},
};
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="less">
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>
<template> <template>
<div>this is person page</div> <span> 页面组件 </span>
</template> </template>
<script> <script>
export default { export default {
......
import Vue from "vue"; import Vue from "vue";
import VueRouter from "vue-router"; import VueRouter from "vue-router";
const Cart = () => import('../views/about'); import globalRoutes from '@/router'
const About = () => import('../views/about');
Vue.use(VueRouter); Vue.use(VueRouter);
// 单入口路由配置 // 单入口路由配置
const routes = [ const routes = [
{ {
path: "/cart", path: "/about",
name: "Cart", name: "About",
component: Cart component: About
} }
]; ];
const router = new VueRouter({ const router = new VueRouter({
mode: "hash", mode: "hash",
base: process.env.BASE_URL, base: process.env.BASE_URL,
routes routes: [
...globalRoutes,
...routes
]
}); });
export default router; export default router;
const hello = () => import('@/views/hello') const Cart = () => import('@/views/cart')
// 单入口路由配置 // 单入口路由配置
const routes = [ const routes = [
{ {
path: "/cart", path: "/cart",
name: "Cart", name: "Cart",
component: hello component: Cart
} }
]; ];
......
<template>
<div>this si cart page</div>
</template>
<script>
export default {
components: {},
data() {
return {};
},
methods: {
},
mounted() {
}
}
</script>
<style>
</style>
\ No newline at end of file
<template>
<div>this is setting page</div>
</template>
<script>
export default {
components: {},
data() {
return {};
},
methods: {
},
mounted() {
}
}
</script>
<style>
</style>
\ No newline at end of file
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