初始化
This commit is contained in:
55
src/views/Home.vue
Normal file
55
src/views/Home.vue
Normal file
@@ -0,0 +1,55 @@
|
||||
<template>
|
||||
<div class="hello">
|
||||
<p>{{$t('message.hello')}}</p>
|
||||
<button @click="switchLang">{{$t('message.switch')}}</button>
|
||||
<div>
|
||||
<About/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import About from './About'
|
||||
export default {
|
||||
name: 'HelloWorld',
|
||||
components: {
|
||||
About
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
label () {
|
||||
return this.$t('message.hello')
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
switchLang () {
|
||||
let lang = ''
|
||||
if (this.$i18n.locale === 'en') {
|
||||
lang = 'cn'
|
||||
} else {
|
||||
lang = 'en'
|
||||
}
|
||||
this.$i18n.locale = lang;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<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>
|
||||
Reference in New Issue
Block a user