mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
29 lines
780 B
TypeScript
29 lines
780 B
TypeScript
import * as React from 'react';
|
|
import DaumPostcode from 'react-daum-postcode';
|
|
|
|
class Postcode extends React.Component<any, any> {
|
|
handleAddress = (data: any) => {
|
|
let fullAddress: string = data.address;
|
|
let extraAddress = '';
|
|
|
|
if (data.addressType === 'R') {
|
|
if (data.bname !== '') {
|
|
extraAddress += data.bname;
|
|
}
|
|
if (data.buildingName !== '') {
|
|
extraAddress += (extraAddress !== '' ? `, ${data.buildingName}` : data.buildingName);
|
|
}
|
|
fullAddress += (extraAddress !== '' ? ` (${extraAddress})` : '');
|
|
}
|
|
|
|
console.log(fullAddress); // e.g. '서울 성동구 왕십리로2길 20 (성수동1가)'
|
|
}
|
|
|
|
render() {
|
|
return (
|
|
<DaumPostcode
|
|
onComplete={this.handleAddress}
|
|
/>
|
|
);
|
|
}
|
|
} |