<template>
|
<div class="hello">
|
<h1>{{ msg }}</h1>
|
<div style="width: 20%;">
|
<el-button type="text" @click="goToindex">官网</el-button>
|
<el-button type="text" @click="goToDistance">计算距离</el-button>
|
<el-button type="text" @click="goToDegree">度分转换</el-button>
|
<el-button type="text" @click="goToCoordinate">坐标计算</el-button>
|
</div>
|
|
<h2>hello</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://chat.vuejs.org"
|
target="_blank"
|
>
|
Community 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: 'HelloWorld',
|
data () {
|
return {
|
msg: 'Welcome to Your Vue.js App'
|
}
|
},
|
methods: {
|
goToDistance() {
|
this.$router.push('/distance'); // 根据自定义的路由设置跳转到指定页面
|
},
|
goToindex() {
|
this.$router.push('/HelloWorld'); // 根据自定义的路由设置跳转到指定页面
|
},
|
goToDegree() {
|
this.$router.push('/degree'); // 根据自定义的路由设置跳转到指定页面
|
},
|
goToCoordinate() {
|
this.$router.push('/coordinate'); // 根据自定义的路由设置跳转到指定页面
|
},
|
onSubmit() {
|
console.log(this.formLabelAlign.name);
|
console.log(this.formLabelAlign.region);
|
console.log('submit!');
|
this.formLabelAlign.type = 2
|
const params = { str: this.formLabelAlign.name };
|
axios.get(url, { params })
|
.then((response) => {
|
console.log('成功获取到后端数据', response.data);
|
// 处理返回的数据
|
console.log(res);
|
this.formLabelAlign.type = res.data
|
})
|
.catch((error) => {
|
console.error('获取后端数据失败', error);
|
// 错误处理
|
});
|
|
},
|
onClear() {
|
this.formLabelAlign.type = ''
|
this.formLabelAlign.region = ""
|
this.formLabelAlign.name = ''
|
}
|
}
|
}
|
</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>
|