Files
ClassContent/历届学生/fontendseven/项目练习/上课项目/uniapp-tpl/pages/index/index.vue
2024-09-27 02:06:13 +08:00

73 lines
1.2 KiB
Vue

<template>
<view class="home">
<h2>你不管</h2>
<HelloWorld msg="哈哈哈哈"></HelloWorld>
<text class="test">你好</text>
<view class="list">
<view class="item" v-for="(item,index) in newsList" :key="index" @click="info(item.id)">
<!-- <navigator :url=" '../info/info?id='+item.id "> -->
{{ item.title }}
<!-- </navigator> -->
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
newsList: [{
id: 1,
title: '新闻1'
},
{
id: 2,
title: '新闻2'
},
{
id: 3,
title: '新闻3'
},
]
}
},
created() {
this.getIndex();
},
methods: {
async getIndex() {
let res = await this.$http.index.home();
console.log(res);
},
info(id) {
uni.navigateTo({
url: `../info/info?id=${id}`
})
},
ld() {
//#ifdef APP-PLUS
uni.setScreenBrightness({
value: 1,
success: function () {
console.log('success');
}
});
//#endif
}
},
onPullDownRefresh() {
console.log('refresh');
setTimeout(function() {
uni.stopPullDownRefresh();
}, 1000);
}
}
</script>
<style lang="less" scoped>
@import "~@/less/page/home.less";
</style>