I am creating an utility utilizing Vue.js and Ionic, and I’ve encountered a problem with the SMS passcode autofill characteristic on iOS. In my app, customers obtain a one-time SMS passcode for authentication. Ideally, when this SMS is obtained, the iPhone ought to detect the passcode and supply to autofill it into the app’s enter fields. Nonetheless, once I faucet on the passcode, which seems above the iOS keyboard, it doesn’t auto fill the enter bins.
This is how I’ve carried out the enter fields in my app:
<kind>
<enter
v-for="(n, index) in code"
:key="index"
kind="textual content"
sample="d*"
:id="'input_' + index"
maxlength="1"
v-model="code[index]"
@enter="handleInput"
@keydown="isNumber"
@keydown.delete="handleDelete"
@paste="onPaste"
/>
</kind>
And this is a snippet from the script:
handleInput(occasion) {
const inputType = occasion.inputType;
let currentActiveElement = occasion.goal;
if (inputType === "insertText") {
if (currentActiveElement && currentActiveElement.nextElementSibling) {
currentActiveElement.nextElementSibling.focus();
} else {
currentActiveElement.blur();
}
}
if (inputType === "insertFromPaste" && this.dataFromPaste) {
for (const num of this.dataFromPaste) {
const id = parseInt(currentActiveElement.id.cut up("_")[1]);
currentActiveElement.worth = num;
this.codehttps://stackoverflow.com/q/78258197 = num;
if (currentActiveElement && currentActiveElement.nextElementSibling) {
currentActiveElement.nextElementSibling.focus();
currentActiveElement = currentActiveElement.nextElementSibling;
} else {
currentActiveElement.blur();
break;
}
}
}
},
isNumber(occasion) {
occasion.currentTarget.worth = "";
const keyPressed = occasion.key;
if (!this.keysAllowed.consists of(keyPressed)) {
occasion.preventDefault();
}
},
handleDelete(occasion) {
let worth = occasion.goal.worth;
let currentActiveElement = occasion.goal;
if (!worth) {
const id = parseInt(currentActiveElement.id.cut up("_")[1]);
this.codehttps://stackoverflow.com/q/78258197 = "";
if (currentActiveElement && currentActiveElement.previousElementSibling) {
currentActiveElement.previousElementSibling.focus();
}
}
},
onPaste(occasion) {
if (occasion.clipboardData) {
const pastedData = occasion.clipboardData.getData("textual content").trim().cut up("").slice(0, 6); // Guarantee solely first 6 characters are thought of
for (let i = 0; i < pastedData.size; i++) {
const inputIndex = parseInt(occasion.goal.id.cut up("_")[1]) + i;
if (inputIndex < this.code.size) {
this.code[inputIndex] = pastedData[i];
const nextInput = doc.getElementById(`input_${inputIndex + 1}`);
if (nextInput) {
nextInput.focus(); // Transfer focus to subsequent enter subject
}
}
}
occasion.preventDefault(); // Forestall default paste habits
}
},
keysAllowed = [“0″,”1″,”2″,”3″,”4″,”5″,”6″,”7″,”8″,”9”]
I’ve examined the copy and paste operate on internet browser and on android gadgets. They’re working as anticipated. Nonetheless, in iOS gadgets, it isn’t working.
Please counsel and lots of thanks!
CP PLUS 3 MP Full HD Smart Wi-fi CCTV Camera | 360° Pan & Tilt | View & Talk | Motion Alert | Night Vision | SD Card (Up to 128 GB) | Alexa & OK Google | 2-Way Talk | IR Distance 10Mtr | CP-E35A
₹1,299.00 (as of April 1, 2024 14:09 GMT +00:00 - More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)Fire-Boltt Phoenix Ultra Luxury Stainless Steel, Bluetooth Calling Smartwatch, AI Voice Assistant, Metal Body with 120+ Sports Modes, SpO2, Heart Rate Monitoring (Gold)
₹1,749.00 (as of April 1, 2024 14:09 GMT +00:00 - More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)OnePlus Nord CE 3 Lite 5G (Pastel Lime, 8GB RAM, 128GB Storage)
₹17,999.00 (as of April 1, 2024 14:09 GMT +00:00 - More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)realme narzo N53 (Feather Gold, 8GB+128GB) 33W Segment Fastest Charging | Slimmest Phone in Segment | 90 Hz Smooth Display
₹8,999.00 (as of April 1, 2024 14:09 GMT +00:00 - More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)Fire-Boltt Ninja Call Pro Smart Watch Dual Chip Bluetooth Calling, 1.69" Display, AI Voice Assistance with 100 Sports Modes, with SpO2 & Heart Rate Monitoring
₹999.00 (as of April 1, 2024 14:09 GMT +00:00 - More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)Ambrane Unbreakable 60W Fast Charging 1.5M Braided Type C to Type C Cable for Smartphones, Tablets, Laptops & other Type C devices, PD Technology, 480Mbps Data Sync (RCTT15, Black)
₹199.00 (as of April 1, 2024 14:09 GMT +00:00 - More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)HP 680 Original Ink Advantage Cartridge (Black)
₹799.00 (as of April 1, 2024 14:09 GMT +00:00 - More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)FUR JADEN Anti Theft Number Lock Backpack Bag with 15.6 Inch Laptop Compartment, USB Charging Port & Organizer Pocket for Men Women Boys Girls
₹649.00 (as of April 1, 2024 14:09 GMT +00:00 - More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)Portronics Konnect L 1.2M POR-1401 Fast Charging 3A 8 Pin USB Cable with Charge & Sync Function (White)
₹129.00 (as of April 1, 2024 14:09 GMT +00:00 - More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)STRIFF Mpad Mouse Mat 230X190X3mm Gaming Mouse Pad, Non-Slip Rubber Base, Waterproof Surface, Premium-Textured, Compatible with Laser and Optical Mice(Universe Black)
₹99.00 (as of April 1, 2024 14:09 GMT +00:00 - More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)Auto Amazon Links: No products found.