首页 > 其他分享 >JS业务

JS业务

时间:2022-11-22 19:58:34浏览次数:48  
标签:count 事件处理 title res request 业务 JS item

1.页面的动态绑定

2.事件处理

3.生命周期函数

4.网络请求

<templete>

  <view>

    <text >{{ title }} </text>

    <text v-for="(item,index) in list " :key="index" > {{ item }} </text>  //循环一下输出列表

    <button @click="clickHandle">按钮</button>//实现:按一次加一次的功能

    <view>

      <view v-for="(item,index) in banners :key="index">

        <text>{{ item.title}}</text>

        <text>{{ item.comtent}}</text>

      </view>

    <view>count</view>

  </view>

</templete>

<script>

  export default{

    //动态绑定

    data( ) { 

      return {

        title: 'HELLO!'

        list:["A","B","C"]

        count:0

        //声明一个存储网络请求的对象

        banners:[ ]

      }

    },

   

    /*

      uniapp生命周期函数

        1.微信小程序

         onload( ) {

          },

        2.vue (此处为vue的)mounted

    */

    mounted{ //连接后台数据

uni.request({
    url: 'iwenwiki.com/api/blueberrypai/getIndexBanner.php'
    success: (res) => {
        this.text = 'request success';
    this.banners = res.data.banner } });

    },

    //事件处理

    methods: {

      clickHandle( ){

        this.count++

      }

    }

  }

</script>  

标签:count,事件处理,title,res,request,业务,JS,item
From: https://www.cnblogs.com/liujy2233/p/16916243.html

相关文章