![]() System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /var/www/html/libs/absol-doc/content/absol/ |
Upload File : |
# Format ## float Thiết lập trong trang web bằng systemconfig ```js systemconfig.numberFormatLocales = "vi-VN"; ``` Mặc định, thiết lập theo định dạng trình duyệt cung cấp, có thể xem bằng lệnh: ```js console.log(1234567.89 .toLocaleString()); ``` ### function parseLocalFloat(s: string, option?: *): string *absol-acomp/js/utils.js* ```js //theo thiết lập tryền vào var x = absol.$.parseLocalFloat('123.456,12', 'vi-VN');//=> 123456.12 //hoặc var y = absol.$.parseLocalFloat('123,456.12', {locales:'en-US'});//=> 123456.12 //mặc định, sẽ lấy từ systemconfig hoặc trình duyệt var y = absol.$.parseLocalFloat('123.456,12'); ``` ### function formatLocalFloat(value: number, opt?: *): number *absol-acomp/js/utils.js* ```js var s = absol.$.formatLocalFloat(123456.12, 'vi-VN');//=>"123.456,12" var s = absol.$.formatLocalFloat(123456.12, {locales:'vi-VN'});//=>"123.456,12" var s3 = absol.$.formatLocalFloat(123456.12, 'en-US');//=>"123,456.12" var s4 = absol.$.formatLocalFloat(123456.12);//=>"123.456,12" theo config ```