Fork me on GitHub
frostbelt's home

想学更多有意思的东西,想做自己的网站,想学画画


  • 首页

  • 归档

  • 标签

国庆国旗渐变头像

发表于 2021-10-03 | 热度 ℃
| 字数统计 0 | 阅读时长 1

国庆国旗渐变头像

小程序中展示小程序码

发表于 2021-10-03 | 热度 ℃
| 字数统计 169 | 阅读时长 1

在小程序中如何展示小程序码?是生成小程序码后放到 CDN 上,给 image 一个 http 地址吗?

使用小程序云开发,没有自己的服务器,没有自己的 CDN 时怎么办?

阅读全文 »

小程序云数据支持模糊查询

发表于 2021-09-20 | 热度 ℃
| 字数统计 106 | 阅读时长 1

小程序云数据库表结构

1
2
3
4
5
6
7
8
9
{
title : "彩色线条",
desc : [
{
type : "text",
text : "给孩子们彩色的梦想",
},
],
}

按 彩色 梦想 模糊查询

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
.where(_.or([
{
"title" : db.RegExp({
regexp : '彩色|梦想',
option : 'i',
}),
},
{
"desc.0.text" : db.RegExp({
regexp : '彩色|梦想',
option : 'i',
}),
},
]))

注: option : 'i', 表示忽略大小写

i18n 使用模板

发表于 2021-09-01 | 热度 ℃
| 字数统计 124 | 阅读时长 1
1
2
3
4
5
6
7
8
9
10
11
12
13
const messages = {
ru: {
'Hello {name}': 'Здравствуйте {name}'
}
}

const i18n = new VueI18n({
locale: 'ru',
fallbackLocale: 'en',
silentFallbackWarn: true,
formatFallbackMessages: true,
messages
})

模板如下

1
2
<p>{{ $t('Hello {name}', { name: 'John' }}) }}</p>
<p>{{ $t('The weather today is {condition}!', { condition: 'sunny' }) }}</p>

输出如下

1
2
<p>Здравствуйте John</p>
<p>The weather today is sunny!</p>

见i18n 回退本地化

i18n 回退本地化

发表于 2021-09-01 | 热度 ℃
| 字数统计 377 | 阅读时长 1

以下语言环境信息的 ja 语言环境中不存在 message 键

1
2
3
4
5
6
7
8
const messages = {
en: {
message: 'hello world'
},
ja: {
// 没有翻译的本地化 `hello`
}
}

当为 VueI18n 构造函数选项指定 fallbackLocale 选项时,message 键使用 en 语言环境进行本地化:

1
2
3
4
5
const i18n = new VueI18n({
locale: 'ja',
fallbackLocale: 'en',
messages
})

在如下情况下

1
2
<p>{{ $t('message') }}</p>
this.$i18n.local = 'ja';

输出如下

1
<p>hello world</p>

注意,默认情况下回退到 fallbackLocale 会产生两个控制台警告:

1
2
[vue-i18n] Value of key 'message' is not a string!
[vue-i18n] Fall back to translate the keypath 'message' with 'en' locale.

会在控制台产生大量警告。为了避免这些警告 (同时保留那些完全没有翻译给定关键字的警告),需初始化 VueI18n 实例时设置 silentFallbackWarn: true

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import VueI18n from 'vue-i18n';
Vue.use(VueI18n);
const i18n = new VueI18n({
locale: 'en',
fallbackLocale: 'en',
silentFallbackWarn: true,
messages: {
en: require('@/assets/languages/en.js'),
hi: require('@/assets/languages/hi.js'),
id: require('@/assets/languages/id.js'),
my: require('@/assets/languages/my.js'),
es: require('@/assets/languages/es.js'),
pt: require('@/assets/languages/pt.js'),
ar: require('@/assets/languages/ar.js'),
bn: require('@/assets/languages/bn.js'),
ta: require('@/assets/languages/ta.js'),
te: require('@/assets/languages/te.js'),
ml: require('@/assets/languages/ml.js'),
mr: require('@/assets/languages/mr.js'),
pa: require('@/assets/languages/pa.js'),
gu: require('@/assets/languages/gu.js'),
kn: require('@/assets/languages/kn.js'),
},
});

微信小程序横屏

发表于 2021-08-25 | 热度 ℃
| 字数统计 150 | 阅读时长 1

最新在小程序中做一个 chart,想让它横屏全屏显示

首先想到的是让它转一下

1
2
3
4
5
6
.canvas{
width: 100vh;
height: 100vw;
transform: rotate(90deg) translate(0, -100%);
transform-origin: 0 0;
}

但并不行,试了下别的 dom 旋转没什么问题,但 canvas 不会转(父容器转了 canvas 也没有跟着转)

阅读全文 »

nginx 禁止恶意 IP 访问

发表于 2021-08-18 | 热度 ℃
| 字数统计 152 | 阅读时长 1
1
2
3
4
location / {
# 禁止恶意 IP 访问
deny xx.xx.xx.xx;
}

可以定义多条
可以禁止 IP 段

被禁止的 IP 访问时返回 403

阅读全文 »

nginx 代理日志问题

发表于 2021-08-18 | 热度 ℃
| 字数统计 160 | 阅读时长 1

nginx 代理 node 服务:

1
2
3
4
5
6
7
8
location / {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Nginx-Proxy true;
proxy_pass http://127.0.0.1:3004;
root /;
}

访问功能一切正常,但日志都进了 error_log

1
2021/08/18 17:17:44 [error] 19134#0: *562152 testing "" existence failed (2: No such file or directory) while logging request, client: xx.xx.xx.xx(ip), server: xxx.xxx.com(host), request: "POST /xxx/xxx(pathname) HTTP/1.1", upstream: "http://127.0.0.1:3004/xxx/xxx(pathname)", host: "xxx.xxx.com(host)", referrer: "https://xxx.xxx(referer)"

阅读全文 »

ssh 连接超时

发表于 2021-08-18 | 热度 ℃
| 字数统计 133 | 阅读时长 1

服务器端

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
修改自动检测时间
sudo vim /etc/ssh/sshd_config
ClientAliveInterval 60
ClientAliveCountMax 3

重启 sshd 服务
systemctl restart sshd

profile 中设置不超时
sudo vim /etc/profile
将 TMOUT 设置为 0
export TMOUT=0
重新加载配置
source /etc/profile

设置完记得重联一下 ssh
阅读全文 »

Centos7 升级 libc.so.6

发表于 2021-08-18 | 热度 ℃
| 字数统计 200 | 阅读时长 1

使用 node-canvas 时报错

1
Error: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found

先查看当前 Linux 服务器 gcc 版本中包含哪些库

1
2
strings /usr/lib64/libstdc++.so.6 | grep GLIBC
strings /usr/lib64/libstdc++.so.6|grep CXXABI

看到没有版本 CXXABI_1.3.9,需要更新 libstdc++.so.6

阅读全文 »
12…16
frostbelt

frostbelt

想学更多有意思的东西,想做自己的网站,想学画画

159 日志
161 标签
© 2021 frostbelt Flag Counter
博客全站共31.7k字