排名
1
文章数
15030
总访问量
216.3万
粉丝数
30
评论数
120
EF CORE 非跟踪查询 AsNoTracking, 不跟踪查询。解决EF 报错is already being tracked. When attaching existing entities

EF非跟踪查询加上AsNoTracking即可,如下:
// 使用非跟踪查询的方式
List<UserDetails> getUserDetails = _userDetailsRepository.AsNoTracking().ToList();
可以解决一些已经存在上下文的错误,比如出现报错:cannot be tracked because another instance with the same key value for {'Id'} i...
.net core 3.0+ json时间格式化 ,全局配置json时间序列化格式

需要先创建格式类:namespace WY.JBLand.API.MyResults
{
public class DateTimeConverters : JsonConverter<DateTime>
{
public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
return DateTime.TryP...
c#,.net 从身份证号拆分出生日。.net没有短横杠字符串转日期格式。自定义字符串转日期格式

代码如下
// 解析出生日期
string birthdayStr = idCard.Substring(6, 8);
DateTime birthday = DateTime.ParseExact(birthdayStr, "yyyyMMdd", null);
.net core实现图片防盗链

创建一个中间件实现图片防盗链简单的就是直接判断Referer
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
namespace TNBLOG.Img.MyMiddleware
{
pub...
uni-app 组件编译到微信小程序后没有样式文件wxss

组件编译到微信小程序没有生成WXSS文件,H5与APP可以正常显示,小程序不行!
解决:不需要引用,去除页面中的import这一引用代码,所有将恢复正常!注释掉不生效组件的引用即可
<script>
// import liySelect from "../../components/liy-select/liy-select.vue"
</script>
vue3 子组件调用父组件方法

[TOC]带有setup()的组合API - context.emit父组件组件
<my-childe ref="RefChilde" @closePopup="closeClassRankingPopup"></my-childe>
子组件组件
setup(props, context) {
function handleClose() {
context.emit('closeClassRankingPopup', 参数);
}...
uni-app loading

显示加载框
//显示加载框
uni.showLoading({
title: '加载中'
});
隐藏加载框
//隐藏加载框
uni.hideLoading();
uni-app 提示框

可以使用showToast,代码如下:
uni.showToast({
title:"上传成功!",
duration:2000
})
官网文档:https://uniapp.dcloud.net.cn/api/ui/prompt.html#showtoast
uni-app实现图片预览

基本用法:在uniapp中,我们可以使用uni.previewImage()API对图片进行预览,具体使用方法如下:
uni.previewImage({
urls: ['https://example.com/image1.jpg', 'https://example.com/image2.jpg'],
current: 0
});
其中,urls参数为一个字符串数组,表示需要预览的图片数组;current参数...
uni-app vue3模板

<template>
<view class="container">
666
</view>
</template>
<script setup lang="ts">
import { ref, reactive } from 'vue'
const state = reactive({
imgList: ['https://img1.baidu.com/it/u=2749857666,40...
vue3+vite读取环境变量

在.env.development与.env.production中配置注意要使用VITE开头比如:VITE_IS_SHOW_MENU = true
读取:
import.meta.env.VITE_ISOnline
注意判断的时候要当成字符串去判断:
if(import.meta.env.VITE_ISOnline=="false")
{
// console.log("这是线下的内容")
}
tip:在生产环境中,...
type {} is missing the following properties......

注意一下ts中的类型检查,类型不确定时使用可以使用any,unknown等类型来处理,或者使用类型断言。
比如一个json定义的一个对象后赋值为{},就会提示上面说的错误。要简单的解决可以给一个any类型就行了,代码如下:
state.editFromData = {} as any
vue3 ts 类型never 上不存在属性

这样解决就行了:
const state = reactive({
taskList: [] as any[], // 如果是对象集合这样写
detail: null as any, // 如果是一个对象这样写
});
uni-app怎么使用uni-app的组件,uni-card,uni-forms等

uni-ui支持 HBuilderX直接新建项目模板、npm安装和单独导入个别组件等多种使用方式。
具体参考官网的文档:https://uniapp.dcloud.net.cn/component/uniui/quickstart.html
介绍一下官网说的:通过 uni_modules 导入全部组件的方式点击官网的这里:
会跳转到这个链接:https://ext.dcloud.net.cn/plugin?id=5...
element el-tag 其他颜色,紫色搭配

代码如下:
<el-tag style="color:rgb(224, 101, 224);border-color: rgb(242, 209, 229);background-color:rgb(252, 234, 252)" size="small">消息</el-tag>