my.vibrate
Call the device vibrate function.
Sample Code
copy
// API-DEMO page/API/vibrate/vibrate.json
{
"defaultTitle": "Vibrate"
}
copy
<!-- API-DEMO page/API/vibrate/vibrate.axml-->
<view class="page">
<button type="primary" onTap="vibrate">
Start vibration
</button>
</view>
copy
// API-DEMO page/API/vibrate/vibrate.js
Page({
vibrate() {
my.vibrate({
success: () => {
my.alert({ title: 'Vibration on'});
}
});
},
});