
这里是离卿的博客,来自湖南省邵阳市,一个就读于中南民族大学的大学生
喜欢像素风的游戏和图片背景,抽象风的表情包,喜欢打乒乓球,散步

这里是离卿的博客,来自湖南省邵阳市,一个就读于中南民族大学的大学生
喜欢像素风的游戏和图片背景,抽象风的表情包,喜欢打乒乓球,散步
默认情况下,ArkTS中的所有类型都是不可为空的,因此类型的值不能为空。这类似于TypeScript的严格空值检查模式(strictNullChecks),但规则更严格。
一般使用三种方式,防止变量为空
if(x==null){
x=''
}
配置OSS Bucket的Referer黑白名单可以防止资源被非法盗用,从而降低不必要的流量成本。
防盗链的核心作用是保护你存储资源的权益与成本,避免第三方未经授权滥用你的资源,结合你使用阿里云 OSS+VuePress 博客的场景,具体作用可分为以下几点:
你的阿里云 OSS 资源(如博客图片)若被其他网站直接嵌入引用(即 “盗链”),这些网站的用户访问图片产生的流量会算在你的 OSS 带宽账单中 —— 防盗链通过限制仅授权域名(如你的liqing6666666.github.io博客、OSS 控制台)可访问资源,阻断第三方盗链的流量消耗,减少你的存储费用支出。
晚上的时候突然发现,图床的图片显示不了了,网上说是gitee的防盗链的问题,我的图床配置的是gitee的图床
然后找了一下其他的,比如github,这个需要配置一个CDN,需要,找了教程试了一下,需要创建一个国外的域名(报错不知道为啥弄了一会解决不了)
而且github最近也有防盗链,访问网址也不太稳定,就只好花钱消灾了
【2022年Typora+PicGo+阿里云OSS服务配置图床保姆级教程】https://www.bilibili.com/video/BV12t4y147Gs?vd_source=3931867e7ca4cd19748820eb6b1ea847
说明
从API Version 10开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
摄像头挖孔区域不属于避让区,页面默认不避让挖孔。
从API Version 12开始,可在module.json5中添加以下配置项,摄像头挖孔区域会视为避让区,实现页面默认避让挖孔:
"metadata": [
{
"name": "avoid_cutout",
"value": "true",
}
],
请求网络数据(网址)和接口数据都需要配置网络权限

import { LengthMetrics } from '@kit.ArkUI'
@Entry
@Component
struct Test {
@State shift:boolean=false;
private scroller:Scroller=new Scroller();
@Builder topTab() {
if(this.shift==false){
Row() {
Swiper() {
Flex({ direction: FlexDirection.Row, wrap: FlexWrap.Wrap,space:{main:LengthMetrics.vp(10),
cross:LengthMetrics.vp(10)}}) {
ForEach("0123456789".split(''), (item: string) => {
Text(item).width(80).height(80).backgroundColor(Color.Pink)
})
}
Flex({ direction: FlexDirection.Row, wrap: FlexWrap.Wrap,space:{main:LengthMetrics.vp(10),
cross:LengthMetrics.vp(10)}}) {
ForEach("!!!!!!!!!!!".split(''), (item: string) => {
Text(item).width(80).height(80).backgroundColor('#ff35c5e9')
})
}
}.width('100%').height(300)
}
}
else{
Row(){
List({space:10}){
ForEach("0123456789!!!!!!!!!!".split(''),(item:string)=>{
ListItem(){
if(item=='!')
Text(item).width(50).height(50).backgroundColor('#ff35c5e9')
else
Text(item).width(50).height(50).backgroundColor(Color.Pink)
}
})
}.scrollBar(BarState.Off)
.listDirection(Axis.Horizontal)
}.height(50)
}
}
build() {
Scroll(){
Column({space:10}){
Text().height(100).backgroundColor('#ffb30f0f').width('100%')
this.topTab()
List({space:10,scroller:this.scroller}){
ForEach('1234565657565656567'.split(''),(item:string)=>{
ListItem(){
Text(item).height(200).width('100%').backgroundColor('#ff6bd73c')
}
})
}.height(this.shift?'calc(100% - 60vp)':'calc(100% - 310vp)').width('80%')
.nestedScroll({
scrollForward:NestedScrollMode.PARENT_FIRST,
scrollBackward:NestedScrollMode.SELF_FIRST
})
.onDidScroll(()=>{
const yoffset=this.scroller.currentOffset().yOffset
if(yoffset>5)this.shift=true;
else this.shift=false;
console.log(yoffset+'')
})
.scrollBar(BarState.Off)
}
}.scrollBar(BarState.Off)
}
}
//在侧滑退出应用时,用于判断是否第二次滑动
private isSecondPressBack:boolean=false;
onBackPress(): boolean | void {
if(this.isSecondPressBack){
return false;
}
else{
this.isSecondPressBack=true;
setTimeout(()=>{
this.isSecondPressBack=false
},1000);
this.getUIContext().getPromptAction().showToast({
message:'再划一次退出',
duration:1800
});
return true;
}
}
javascript使用关键字function定义函数
可以是声明定义,也可以是表达式
function functionName(parameters) {
执行的代码
}