Files
ClassContent/历届学生/罗朝/项目练习/天气预报_vue/src/components/index.vue
2024-09-27 02:06:13 +08:00

51 lines
763 B
Vue
Executable File

<template>
<div class="hello">
<h1>{{ msg }}</h1>
<h2>
<router-link :to="{ name: 'info', params: { id: '1',title: 'title' }}">详情</router-link>
</h2>
</div>
</template>
<script>
export default {
created() {
this.getData()
},
data () {
return {
msg: '你好'
}
},
methods: {
getData() {
var params = {
cityname: '合肥'
};
this.$service.getWeatherData(params, function(res) {
console.log(res)
})
}
},
}
</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>