uni-app 之 获取input输入内容

uni-app 之 获取input输入内容

定义名称 v-model="logon_phone"
获取内容 console.log("111 111 logon_phone 打印 ", this.logon_phone)

<template>
    <view style="width: 100%; display: flex; flex-direction:column; align-items:center;">

        <view style="width: 60%; margin-top: 100px;">

            <view style="display: flex; ">
                <u-input placeholder="请输入手机号码" v-model="logon_phone" />
                <button @click="getphoneurl">验证码</button>
            </view>


            <!-- <text>retCode={{urlretCode}}; </text>
            <text>retMsg={{curlretMsg}}; </text> -->

        </view>

    </view>
</template>

<script>
    export default {
        data() {
            return {
                // urlretCode: "",
                // curlretMsg: "",
                logon_phone: "",
            };
        },
        methods: {
            // 按钮点击后执行的方法

            getphoneurl() {
                // uni.showLoading({
                //  title: "加载中" // 加个进度条
                // })

                console.log("----- phone打印 ", this.logon_phone)

                uni.request({

                    url: "https://api.xxx.com/xxx/xxx/" + this.logon_phone,
                    success: res => {
                        console.log(res) // log打印获取的数据
                        // this.urlretCode = res.data.retCode
                        // this.curlretMsg = res.data.retMsg
                        // uni.hideLoading() // 加载出来后,关闭进度条
                    }
                })
            },

        },
        onLoad() {
            // 页面刚进去就初始化的方法

            // this.getphoneurl(),
        }
    }
</script>

<style lang="scss">

</style>
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值