Blame view

pages/API/make-phone-call/make-phone-call.vue 1.06 KB
4b045f7c   刘淇   江阴初始化项目
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
  <template>
  	<view>
  		<page-head :title="title"></page-head>
  		<view class="uni-padding-wrap uni-common-mt">
  			<view class="uni-hello-text uni-center">请在下方输入电话号码</view>
  			<input class="input uni-common-mt" type="number" name="input" @input="bindInput" />
  			<view class="uni-btn-v uni-common-mt">
  				<button @tap="makePhoneCall" type="primary" :disabled="disabled">拨打</button>
  			</view>
  		</view>
  	</view>
  </template>
  <script>
  	export default {
  		data() {
  			return {
  				title: 'makePhoneCall',
  				disabled: true
  			}
  		},
  		methods: {
  			bindInput: function (e) {
  				this.inputValue = e.detail.value
  				if (this.inputValue.length > 0) {
  					this.disabled = false
  				} else {
  					this.disabled = true
  				}
  			},
  			makePhoneCall: function () {
  				uni.makePhoneCall({
  					phoneNumber: this.inputValue,
  					success: () => {
  						console.log("成功拨打电话")
  					}
  				})
  			}
  		}
  	}
  </script>
  
  <style>
  	.input {
  		height: 119rpx;
  		line-height: 119rpx;
  		font-size: 78rpx;
  		border-bottom: 1rpx solid #E2E2E2;
  		text-align:center;
  	}
  </style>