|
@@ -30,6 +30,8 @@
|
|
|
var config = require('../../common/config_gyq.js');
|
|
|
var http = require('../../common/request');
|
|
|
const common = require('../../common/common.js');
|
|
|
+ import dayjs from 'dayjs'
|
|
|
+ import 'dayjs/locale/zh-cn';
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
@@ -72,18 +74,18 @@
|
|
|
user_token && this.loadUserInfo()
|
|
|
},
|
|
|
methods: {
|
|
|
- // 输入处理
|
|
|
- handleInput(e) {
|
|
|
- // 延迟处理输入法组合输入
|
|
|
- setTimeout(() => {
|
|
|
- const value = e.detail.value;
|
|
|
- const truncated = this.truncateToMaxBytes(value, 22);
|
|
|
- // 更新值(避免无限触发,需判断)
|
|
|
- if (truncated !== value) {
|
|
|
- this.userInfo.nickname = truncated;
|
|
|
- }
|
|
|
- }, 0);
|
|
|
- },
|
|
|
+ // 输入处理
|
|
|
+ handleInput(e) {
|
|
|
+ // 延迟处理输入法组合输入
|
|
|
+ setTimeout(() => {
|
|
|
+ const value = e.detail.value;
|
|
|
+ const truncated = this.truncateToMaxBytes(value, 22);
|
|
|
+ // 更新值(避免无限触发,需判断)
|
|
|
+ if (truncated !== value) {
|
|
|
+ this.userInfo.nickname = truncated;
|
|
|
+ }
|
|
|
+ }, 0);
|
|
|
+ },
|
|
|
// 截断字符串至指定字节
|
|
|
truncateToMaxBytes(str, maxBytes) {
|
|
|
let totalBytes = 0;
|
|
@@ -102,8 +104,8 @@
|
|
|
},
|
|
|
|
|
|
formatTimestamp(timestamp) {
|
|
|
- const date = new Date(timestamp * 1000);
|
|
|
- return date.toLocaleDateString('zh-CN'); // 本地化格式(如:2021/5/3)
|
|
|
+ dayjs.locale('zh-cn');
|
|
|
+ return dayjs.unix(timestamp).format('YYYY/M/D'); // 严格中文格式
|
|
|
},
|
|
|
inpfn(e) {
|
|
|
console.log(e.detail.value)
|