春暖花又开
解决 amh 面板 (lnmp) 安装后内存占用 1300M+ 的问题?
新安装amh面板,(
lnmp (nginx-1.24 + mysql-5.7 + php-7.4)),内存占用1300多M?怎么解决呢?
重启
春暖花又开
华为官网鼠标悬浮图片,右侧放大功能怎么做的?
"图片.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/images/20250112/c6e9d088b0642c0c183288490ba5d66b.png)
春暖花又开
x轴有两个系列的要怎么做?
OP的效果一般叫X轴两级化
第一种
"image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/images/20250110/15d6b929fe74768aed6f6af4d673fd7a.png)
####
echarts自定义分组-静态
var chart = echarts.init(document.getElementById('bar'));
var xAxisData = ["长裤", "短裤", "衬衣", "羊毛衫", "背心", "皮鞋"];
//var xAxisGroupData = [ "裤子", "裤子", "衣服", "衣服", "衣服" , "鞋子" ];
var xAxisGroupData = ["{offset|}裤子", "", "", "衣服", "", "鞋子"]; // 分组显示的标签(组内如果是偶数加上偏移{offset|},如果是计数放正中间)
var seriesData = [15, 20, 10, 5, 15, 10];
var groupSeparates = [true, false, true, false, false, true]; // 分组分隔线
// 指定图表的配置项和数据
var option = {
title: {
text: 'echarts自定义分组-静态'
},
tooltip: {},
xAxis: [{
position: "bottom",
data: xAxisData,
axisTick: {
length: 20 // 刻度线的长度
},
axisLabel: {
margin: 10 // 标签到轴线的距离
}
}, {
position: "bottom",
data: xAxisGroupData,
axisTick: {
length: 40,
interval: function (index, value) {
return groupSeparates[index]; // 根据标识分组的刻度线
}
},
axisLabel: {
margin: 30,
interval: 0, // 显示所有标签
rich: {
offset: {
width: 0
}
}
}
}],
yAxis: {},
series: [{
type: 'bar',
data: seriesData
}]
};
chart.lastBandWidth = 0;
// 监听渲染事件,只要bandWidth发生变化,重新设置标签偏移的值
chart.on('rendered', function () {
var bandWidth = chart._chartsViews[0].renderTask.context.outputData._layout.bandWidth;
if (chart.lastBandWidth != bandWidth) {
chart.lastBandWidth = bandWidth;
// 延时执行否则echarts渲染异常
setTimeout(() => {
// 加上偏移后重新绘制
var optionNew = { xAxis: [{}, {}] };
// 增量更新偏移值
optionNew.xAxis[1] = { axisLabel: { rich: { offset: { width: chart.lastBandWidth } } } };
//console.info(optionNew);
chart.setOption(optionNew);
}, 0);
}
});
// 绘制
chart.setOption(option);
第二种:
"image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/images/20250110/7bb3901532745023c5ec8da3b7d8237c.png)
«"https://echarts.apache.org/examples/zh/editor.html?c=bar-> back..." (https://link.segmentfault.com/?enc=f6joHCo1%2BkAgM48zUNRAOQ%3D%3D.lDXr9g6kAx1RnyHM5RUhrilfx1t4D9E%2FoKhssevw86wBzLny0YlZ%2BoqMHs4AbZVsLzMi00QusZSP4EU41UA1vXtdBgidWAUDh3tMUqkPtyeYe2aCz%2FEK0%2FGiLwtp7M6dw88bYgRJwTx2RVXmghnSH%2B9Q5VpKW%2F3%2FTPB57q19dHl3mThysg6bsoKjcpO16uLGkB%2B%2F43JYMUVuQdt3wax39SOh4vbLDZo17Z0Y%2FwofptpgpT%2BJvC22U%2Fi1d6OQozHab9AqkF1OTwZh3ZDvimFHY4xWBAJhTZyo6%2F1E8XbKi1nc0rBSxS2Maqpcb3zzSULV%2Fc4Jeew9BMdi9XrB7uTzn0GFZnrXT%2Fe58utb1AP28e4v%2Fz41%2BP3F9d2JYzB0FhRCQbI3RTIlN24%2BzqiMsN9HBhIQLiMLad5xBdnDyzA3zeFEopHy7YtI0PHSPgMBdv4vT60CV3gfpeEcPVxD6A5Ed29i9vWzeONYAxIq1djkn9CZDxxPZDOTrFl6MvUKqM8M7wWKgn44y1B%2B9O74h0CnNlDAlw2yiiIqjowCFPjZYKPrdHu8iIc7zhVbuZ6P2%2FnI6doPMyMmhnMskqzeoTgQRzo18WGuweZUB0hiHjtq9w6MpZo0BDn0ZttNUvO7GLeWxCOX15N7esbgG7SmKOOYr3XzOuz2SpnMW5I313iy3Z7gRxGfJ3r5%2FvkUGO8Pih1gWsQgFt0J04H01P%2FsYZivHtjtKQcGsTPsuhflZhANn%2F38ADNN%2BVLpO5Ljl7L8GuFaWVZpgcpQtCMiGcZmOCclahc3ET%2B%2BqNHTjcoU2q5Px%2BTrOr5t8J7kM%2B1HY8ZRaPi7rtfw%2BD7%2BIzw5Uapk8v%2BYE%2B0Drlnh4g3DzHy2JhS0kC4LCS8REkUw6RNEFTc%2FWm4169RIMmNxGc4wC6sR%2FNs1NObv0QPdaBFTn6pDDtA4gYXR%2BHu%2BS7HAXeIorBcjrRFm88UG6JFMCMjH6yNDn5QF%2FOj%2FhKgSnlVRGN3NRTzA7Ml7p2P90%2FQyTLZ9QNf8GvE0)»
春暖花又开
想要global覆盖样式:app/pages/components/AntdCustomStyle/index.module.css Unknown word?
想要覆盖antd的默认样式,
// AntdCustomStyle/index.module.css
:global(
.ant-tabs-tab {
background-color: red;
}
)
// AntdCustomStyle/index.tsx
import React, { useState } from 'react'
import {Tabs} from 'antd'
import './index.module.css'
const initialItems = [
{ label: 'Tab 1', children: 'Content of Tab 1', key: '1' },
{ label: 'Tab 2', children: 'Content of Tab 2', key: '2' },
{
label: 'Tab 3',
children: 'Content of Tab 3',
key: '3',
closable: false,
},
];
function index() {
const [items, setItems] = useState(initialItems);
return (
)
}
export default index
但是却报错如下:
./pages/components/AntdCustomStyle/index.module.css:3:3
Syntax error: /Users/john/Desktop/Test/js/typescript/ts-test01/my-app/pages/components/AntdCustomStyle/index.module.css Unknown word
1 |
2 | :global(
> 3 | .ant-tabs-tab {
| ^
4 | background-color: red;
5 | }
"image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/images/20250105/983393a4ab9dca85d93fa3bc9f24ad04.png)
请问这是哪里有问题啊,应该就是这样写的?
***
编辑1
感谢:然后去远足的回复。但是我这样做之后还是报错:
:global(.ant-tabs-tab ){
background-color: red;
}
或者
.myClass {
:global(.ant-tabs-tab ){
background-color: red;
}
}
"image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/images/20250105/7a204d535091b852023a3068a53da58d.png)
春暖花又开
docker部署前端nginx跨域不生效怎么回事?
这是我的default.config文件设置
"029529c71e2ee05a660d8b7b6031569.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/images/20241229/ab566e7164853b030fdffcbb438e0018.png)但是怎么搞我的线上项目请求都是跨域状态"198eca0db3c1a01ef57743f760e70d7.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/images/20241229/38543694d2a381722a7335449d36b183.png)
春暖花又开
Spring接口没有实现类为什么可以进行注入?
在学习spring中,发现一段代码
定义接口
public interface BrandDao {
@Select("select * from brand where id = #{id}")
//配置数据库字段和模型实体类属性映射
@Results({
@Result(column = "brand_name", property = "brandName"),
@Result(column = "company_name", property = "companyName")
})
Brand findById(Integer id);
}
定义一个service类
@Service
public class BrandService {
@Autowired
private BrandDao brandDao;
public Brand findById(Integer id) {
return brandDao.findById(id);
}
}
执行方法
public class App {
public static void main(String[] args) {
ApplicationContext ioc = new AnnotationConfigApplicationContext(SpringConfig.class);
BrandService brandService = ioc.getBean(BrandService.class);
Brand brand = brandService.findById(2);
System.out.println(brand);
}
}
上面代码可以正常运行,就是BrandDao接口他并没有实现类,为什么可以通过@Autowired进行注入?
PS:应该是SpringConfig代码的这段已经有bean了:
//定义bean,返回MapperScannerConfigurer对象
@Bean
public MapperScannerConfigurer mapperScannerConfigurer(){
MapperScannerConfigurer msc = new MapperScannerConfigurer();
msc.setBasePackage("com.test.dao");//BrandDao接口属于这个包下
return msc;
}
春暖花又开
如何把数组对象转成对象的格式?
[{ a: 1 }, { b: 2, c: 3 }].reduce((r, c) => Object.assign({}, r, c), {})
春暖花又开
vue2项目封装的表单组件传递数据的时候到底要不要传递object类型?
我们项目的做法是图方便,直接通过对象传递整个表单数据,然后双向绑定对象里的属性,虽然这么做看似没有影响vue单向数据流的规范,因为没直接修改对象的地址,但是里面的属性是在不断变化。会有什么问题吗,各位有什么比较好的方案。
春暖花又开
曲线积分问题?
这不是极坐标,就是换元。
y=sin(t), y 在 (0,1) 对应 t 在 (0,pi/2) ,在这个区间,sin(t), cos(t) 都是正的。
直接做 y=sin(t) 的换元:
$$ \int_0^1 \frac{y^2}{\sqrt{1-y^2}}dy \
=\int_0^{\frac{\pi}{2}}\frac{\sin^2t}{\sqrt{1-\sin^2t}}d\sin t\
=\int_0^{\frac{\pi}{2}}\frac{\sin^2t}{\sqrt{\cos^2t}}\cos tdt\
=\int_0^{\frac{\pi}{2}}\sin^2tdt\\ $$
春暖花又开
前端配置文件的正确方式?
频繁变动的话,一般来说应该将数据存储在数据库,数据库会建立一张表,内容是关于系统配置信息的,通过后端传递给前端。
优点是数据方便管理,扩展性高,安全问题可以通过后端得到解决。
缺点是系统复杂性增加,需要考虑数据库表结构等。读取数据要考虑性能问题。数据库故障会连带着前端报错。
春暖花又开
vue+js 如何限制并发上传数?
有这么一个需求:需要上传几千张图片到后端接口
使用 python 的时候,可以线程池来实现并发控制
import os
from loguru import logger
from pathlib import Path
from PIL import Image
from mark import BASE_DIR
from PIL import UnidentifiedImageError
import requests
from concurrent.futures.thread import ThreadPoolExecutor
pool = ThreadPoolExecutor(10)
images_dir: Path = Path(
'/Volumes/MyPassport/iv测试图片集')
def get_file_size(file_path: Path) -> int:
return os.path.getsize(file_path)
formats = ('jpg', 'jpeg', 'png')
images = [images_dir /
f for f in os.listdir(images_dir) if f.endswith(formats) and not f.startswith('.')]
images.sort()
logger.debug(f'一共有 {len(images)} 个图片')
def func(index: int, image: Image):
try:
logger.debug(f'{index}/{len(images)-1} {image.name}')
with open(image, 'rb') as file:
response = requests.post(
'http://127.0.0.1:6200/meta/image/file',
files={
'file': file
}, data={
'network': 'vgg16'
})
assert response.status_code == 200
except (UnidentifiedImageError, OSError) as error:
logger.warning(error)
os.remove(image)
for index, image in enumerate(images):
pool.submit(func, index, image)
pool.shutdown(wait=True)
但是使用 vue+js 的时候,我不知道可以怎么操作
我用 vue+js 写的函数如下
const handleUpload = () => {
fileList_1.value.forEach((item, index) => {
const formData = new FormData();
formData.append("file", item.originFileObj);
console.log(`第 ${index + 1} 个文件上传`, item.name);
axios
.post("/api/meta/image/file", formData)
.then((response) => {
if (response.status === 500) {
console.error(`第 ${index + 1} 个文件上传失败:`, response.data);
message.error(response.data.message);
} else {
responseBody.value = response.data;
responseData.value = response.data;
message.success(item.name + " 上传成功", 2);
}
})
.catch((error) => {
console.error('捕捉到错误了', error);
message.error(error.response.data.message);
});
})
};
这个函数有一个问题,当在浏览器同时选中 1000 个图片,然后点击上传的时候,貌似会同时发出 1000 个 HTTP
请求,这个是非常危险的,而且会让浏览器变得非常的卡顿
我希望可以实现:不管需要上传多少个文件,并发上传数不超过 10
我的 vue+js 完整代码如下
使用说明:
选择图片
评分范围在 0-100 分,100 分是满分。如果图片相似度太小,会出现负分
-->
选择图片
上传
{{ item.hash_code }}
import { PlusOutlined, LoadingOutlined } from "@ant-design/icons-vue";
import { ref, reactive } from "vue";
import { message } from "ant-design-vue";
import { UploadOutlined } from "@ant-design/icons-vue";
import axios from "axios";
import { onMounted } from "vue";
import router from "@/router";
onMounted(async () => {
document.title = "图片录入"; // 设置浏览器标签页的标题
});
function getBase64(file) {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => resolve(reader.result);
reader.onerror = (error) => reject(error);
});
}
const fileList_1 = ref([]);
const handleBeforeUpload1 = (file) => {
// fileList_1.value.splice(0);
return false; // 阻止默认上传行为
};
const previewVisible = ref(false);
const previewImage = ref("");
const previewTitle = ref("");
const handleCancel = () => {
previewVisible.value = false;
previewTitle.value = "";
};
const handlePreview = async (file) => {
if (!file.url && !file.preview) {
file.preview = await getBase64(file.originFileObj);
}
previewImage.value = file.url || file.preview;
previewVisible.value = true;
previewTitle.value =
file.name || file.url.substring(file.url.lastIndexOf("/") + 1);
};
const responseBody = ref(null);
const responseData = ref([]);
const handleUpload = () => {
fileList_1.value.forEach((item, index) => {
const formData = new FormData();
formData.append("file", item.originFileObj);
console.log(`第 ${index + 1} 个文件上传`, item.name);
axios
.post("/api/meta/image/file", formData)
.then((response) => {
if (response.status === 500) {
console.error(`第 ${index + 1} 个文件上传失败:`, response.data);
message.error(response.data.message);
} else {
responseBody.value = response.data;
responseData.value = response.data;
message.success(item.name + " 上传成功", 2);
}
})
.catch((error) => {
console.error('捕捉到错误了', error);
message.error(error.response.data.message);
});
})
};
const navigateToRoot = () => {
router.push("/");
};
body {
background-color: #e9ecef !important;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.gray-placeholder {
color: gray;
}
.container {
margin: 0 auto;
/* 居中显示 */
margin-top: 20px;
max-width: 1440px;
/* 设置最大宽度为900px */
background-color: #ffffff;
/* 浅灰色 */
border-radius: 0.25rem;
}
.container-item {
padding: 25px;
border-width: 0 0 1px;
margin-bottom: 20px;
}
.theme-icon {
width: 64px;
/* 设置图标的宽度 */
height: 64px;
/* 设置图标的高度 */
}
.avatar-uploader>.ant-upload {
width: 128px;
height: 128px;
}
.ant-upload-select-picture-card i {
font-size: 32px;
color: #999;
}
.ant-upload-select-picture-card .ant-upload-text {
margin-top: 8px;
color: #666;
}
春暖花又开
flask 报错求解?
"flask.Request.method" (https://link.segmentfault.com/?enc=PDIaijNR7sX4I763RolE%2FQ%3D%3D.2O7L9au67x5qzVE2w9hLqUoUggyQ8GtI%2Feod%2Fc1hUBHeP4kaowWOAVbae%2FdoXqkGH7DOQPXAHzDaoZyHBk244g%3D%3D)
是 "GET" 不是 "get"
春暖花又开
自定义表格最后一行内容?
如果所示,想实现最后一列实现商品总计展示,写了一个计算属性想通过show-summary、@summary-method方法来实现展示,还想实现合计后面的列合并成一列展示(想的是操作样式来隐藏右边框,但是没实现!!!)
"image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/images/20241220/121a0fa76fb4e455ea1f135211d23e01.png)
"image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/images/20241220/18a4cb326feac05548317518de69af23.png)
贴上我的代码:
删除
import { ref, computed } from "vue";
interface Fruit {
fruit: string;
price: number;
ischeck: boolean;
id: number;
num: number;
}
const tableData = ref([
{
fruit: "苹果",
price: 10,
ischeck: true,
id: 1,
num: 1,
},
{
fruit: "猕猴桃",
price: 10,
ischeck: true,
id: 1,
num: 1,
},
{
fruit: "李子",
price: 10,
ischeck: true,
id: 1,
num: 1,
},
{
fruit: "榴莲",
price: 10,
ischeck: true,
id: 1,
num: 1,
},
]);
interface Product {
id: string
name: string
amount1: string
amount2: string
amount3: number
}
const getSummaries = (param: any):any => {
const { columns, data } = param
console.log(columns);
let sums = ['合计', 380,getAllTotal]
return sums
}
const getAllTotal = computed(() => {
return tableData.value.reduce((cur, item) => {
return cur + item.num * item.price;
}, 0);
});
.el-table__footer-wrapper{
tr:not-child(:first-child){
td{
border-right: none !important;
}
}
}
最后想实现的效果图:
"image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/images/20241220/397af8e578035b8eb4a3ee8f94a2ccbe.png)
春暖花又开
如何解决动态创建的droppable的over事件无法被第一时间触发的问题?
我最终通过使用draggble元素的refreshPositions属性解决了这个问题,当refreshPositions为true时,拖拽draggable元素会使其计算所有可放置的位置,从而解决了新创建的circle无法被检测到的问题。然而,据我所知,当div内的circle数量过多时,这会大幅影响到性能。如果任何人有更高的方法解决这个问题,我非常欢迎!
春暖花又开
纯前端如何实现一个本地数据库来存取数据?
自己想做一个纯前端的项目(不会后端开发),有数据的录入和展示分析的功能。
用vue开发页面的功能,表单录入数据之后存下来(每天都要去录入),在分析页面显示出来。
最后build打包之后将前端代码放到服务器上。
一开始想用localStorage存取,但是他是存到浏览器上,换个电脑之前数据就没有了。
然后想着js写入txt和读取txt文件的方式来实现一个类似数据库的东西,但好像有兼容性的问题。
纯前端有什么更好的方式去实现吗?
春暖花又开
js 多维数组转换问题?
let arr = [
[1, 3, 5],
[7, 9, 12]
];
let newArr = arr[0].map((_, i) => arr.map(row => row[i]));
console.log(newArr);
春暖花又开
这样的布局怎么写?
宽度不定,间距相同,左对齐。
"image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/images/20241213/7f426ef1e82ed5ba04f2bd31fae02ce4.png)
春暖花又开
明明下载了npm模块但是提示This dependency was not found?
明明下载了npm模块但是提示This dependency was not found?
"而且在node_modules中能找到下载的模块。"
"image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/images/20241210/7be3aa9a72bf210459d021324508e020.png)
春暖花又开
一个typescript动态给实例添加方法后如何能让实例识别到方法的问题?
有个 EventEmitter 类,其 installTo 核心部分摘要如下,主要作用是在目标对象中添加 'on', 'off', 'emit',
'fire', 'once' 方法。
class EventEmitter {
static installTo(obj: object): void {
const eventEmitter = new EventEmitter();
const methods = ['on', 'off', 'emit', 'fire', 'once'];
methods.forEach((method) => {
Object.defineProperty(obj, method, {
value: (eventEmitter as { [key: string]: any })[method],
enumerable: false,
writable: false,
configurable: false,
});
});
}
}
现有一个 LRU 类,其构造函数中 通过 EventEmitter.installTo(this) 将 EventEmitter 的方法添加到 LRU
实例中,部分代码如下:
class LRU {
constructor(options?: number | LRUOptions) {
EventEmitter.installTo(this); // 当然这里是可以做成一个装饰器的,但与此问题无关。
}
}
此时 ts 中以下代码将会报错
const lru = new LRU(10)
lr.on('xxx') // 提示:Property 'on' does not exist on type 'LRU'
我该如何处理让 LRU 的示例上能正确识别出 on 方法?
***
首先我知道的几个方案:
1. 继承, 直接让LRU 继承 EventEmitter 即可,这样能识别。但是我不想这样做,两者并无实际关系,继承不太合适。
2. 在 LRU 类里面直接写 "on = EventEmitter.prototype.on;" 等类似的代码,这样实际是额外再给LRU的实例上加了这些方法的引用。但这样,1是和EventEmitter.installTo有重复(内部还有其他细节处理逻辑)2是代码有耦合。
请问有什么办法能处理这个问题吗? 初使用typescript,可能对此不熟悉,如有好的方案请指出。
***
感谢乔治的答案。
最终解决方案,如下:
// 从EventEmitter 中获取需要的方法
type EventEmitterMethods = Pick;
// LRU 实现省略
class LRU {}
// 声明合并
interface LRU extends EventEmitterMethods {}
春暖花又开
如何处理 H5 视频在百度 APP 置顶问题?
问题描述
H5 视频在百度 APP 打开时,视频会出现置顶现象,无论是 ios 还是 android。
可以用百度 app 打开这个链接(啊里集团官网也出现这种兼容性问题...)
"https://ali-home.alibaba.com/" (https://link.segmentfault.com/?enc=Ri%2FVFyHADu%2BNZ6T1u4C3xA%3D%3D.H207iz%2BO0ipIa56AMtlZwuQPopfIyRKtBw92dXXp0aw%3D)
"image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/images/20241205/0113b59ec24dba05c4b821540abdb96f.png)
视频显示就会这样,置顶在上方,使网页内容被遮盖住
问题出现的环境背景及自己尝试过哪些方法
我参考过相关的文章:"https://segmentfault.com/a/1190000021906061" (https://segmentfault.com/a/1190000021906061)
ios 可以通过引入同域的视频地址来解决(按我测试的话,不能带域名...):
而 android 的话我无法解决,文字不能通过绝对地位覆盖在视频上方,而且视频还是会置顶。
相关代码
粘贴代码文本(请勿用截图)
你期待的结果是什么?实际看到的错误信息又是什么?
如何解决这种现象,使视频正常显示,没有出现置顶
春暖花又开
uniapp自定义导航栏,有下面一个问题,应该怎么解决?
导航栏返回事件
handleBack() {
const pages = getCurrentPages()
if (pages.length > 1) {
uni.navigateBack({
delta: 1,
success: () => {
}
})
} else if (pages.length === 1) {
uni.switchTab({
url: "/pages/A/A"
})
}
},
现有三个页面,A页面也就是工作台bench页面,B页面是列表页面,C是排查页面
在B页面
uni.navigateTo({
url: "/pages/C/C"
})
在C页面
uni.redirectTo({
url: "/pages/B/B"
})
现有这么一个问题:在C页面返回B页面之后,在B页面内调用handleBack方法时,返回的还是列表页面,如何才能直接返回A页面
春暖花又开
请问亲前端如何实现ping的工具呢?
目测是不能实现的,ping本身是基于icmp协议的,这个在浏览器里面没法实现。在浏览器里面也没办法拿到ttl这个参数。
现在浏览器上能看到的ping,大概率是发起HTTP请求,然后获取响应时间,也可能是服务端帮忙ping,然后显示在前端。
春暖花又开
前端是react, 后台nginx转发, 网页加载前文件刷新有某个几百k文件会耗时一分钟,偶现,这是为啥?
怎么构建的?怎么部署的?不会是把开发环境代理出来了吧?
春暖花又开
查询名下手机号的api?
产品有个需求,要求输入手机号、身份证等信息查询此人名下所有的手机号或银行卡信息
具体有哪几个手机号或者哪个银行的银行卡就行,详细的信息不需要了解
有没有能满足这一项或两项的api
谢谢诸位
春暖花又开
vscode的mdn提示怎么也变成中文的呢?
"image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/images/20241117/c2bf11fcee8a3491ebaa527b58a4578d.png)
春暖花又开
2. 在图表点击事件后,如何使图形保持高亮状态?
图表点击事件调用dispatchAction使图形高亮后,怎么保持鼠标移动后,图形依旧保持高亮
鼠标移动后,图形依旧保持高亮
春暖花又开
web的h5调起相机和选择图库怎么实现?
Web 开发只能使用浏览器提供的功能,无法突破浏览器的限制,所以只能这样用。
春暖花又开
AMH中指定外部数据库的方法?
AMH主要是LNMP、LAMP、LNGX应用环境,前者创建时是要指定PHP与MySQL版本,
创建后你网站可以不使用本地数据库啊,使用IP连接外网数据库,PHP在环境列表或主机列表也可以停止掉,
也可以使用命令停止掉MySQL:
amh mysql stop
停止面板则:
amh amh-7.1 stop
启动即都用start
网站不使用本地数据库的话其实占用也很少的(10MB内存左右)一般不建议停止掉。
春暖花又开
elementplus的el-row和el-col布局遇到问题?
1. 这是写的布局
"布局" (https://wmlx-new-image.oss-cn-shanghai.aliyuncs.com/images/20241105/fe5bca11a032277fbbca95e5ad91c075.png)
2. 这是样式 图表和排行的高度
"样式" (https://wmlx-new-image.oss-cn-shanghai.aliyuncs.com/images/20241105/41382b1b576c471651debb3a8c4d445d.png)
3. xl屏幕下的响应式效果 可以看到分为左右两列, 左列有2行2列, 右列有1行1列
"xl屏幕下效果" (https://wmlx-new-image.oss-cn-shanghai.aliyuncs.com/images/20241105/2c11b2add0696f587a8960646382bdb9.png)
4. md屏幕下因为charts图表不能太窄,所以做了个占满一行,这样就会导致1 2 行的高度加起来正好等于右列排行的高度, 3 4图表就掉下去了, 可以让3 4 图表跨row占满右边排行col占的列吗?
"image.png" (https://wmlx-new-image.oss-cn-shanghai.aliyuncs.com/images/20241105/a5ec89d0b11999b247dfe66008bbaab5.png)
5. 我有想过用屏幕监听,去动态设置排行的高度, 但是那样实在太长..
春暖花又开
canvas图片转换base64,由于图片过大,ios获取url失败?
图片大概是13M,安卓没有问题。
代码如下:toDataURL('image/jpeg',0.89);
返回后没有base64,只有一个data:;
春暖花又开
拆分成微服务疑问,按 controller 还是按照 project 拆?
如果老代码互相依赖很严重,不如不拆,就把基础模块拆出来行了,业务模块一个模块也没什么;
比如A用b,b用a就不如不拆,很简单的一个例子A业务上来了,扩容吧,A也用了B,B阔不阔?
有时候盲目拆没必要,做好灰度发布,维护好全局事务就行了
春暖花又开
关于React useCallback使用的问题?
因为
(()=>{}) !== (()=>{})
所以当"prop"中有函数 作为依赖项 的时候,"React.memo"会失去效果,无论你做了父组件啥都会触发更新
所以用"useCallBack"去封装一次函数就可以达到你要的效果
同理在"useMemo"也是一样的
所以在新手学习"React-hook"的时候"官网" (https://link.segmentfault.com/?enc=da23jlqnp89Johy1QhkjNQ%3D%3D.LpEYpHUV%2FllNLMmofBbONVUjrn9GHC%2BGMTC5QPpJvzX%2BnyG2VyfDRaDmJkKHVCNQjFBi8D%2Bj823BCoF4tNnayw%3D%3D)都会强烈建议打开"eslint-plugin-react-hooks"
春暖花又开
如何去除 Microsoft Word 中自动添加的制表符(Tab)?
问题
请问 Microsoft Word 为什么会为列表自动添加制表符(Tab),我该如何去除它?
详细描述
平台:macOS
软件版本:Microsoft Word 2021
问题:Microsoft Word 交叉引用这个功能只能引用列表项
,于是我自定义了一个列表样式,具体设置如下,我把所有缩进相关全改为0,所谓的制表位也完全是空的,我不太能理解这个 Tab 符是怎么被添加进去的
https://wmlx-new-image.oss-cn-shanghai.aliyuncs.com/images/20241024/719c51d189b50aa0780a19b8e1589338.png
https://wmlx-new-image.oss-cn-shanghai.aliyuncs.com/images/20241024/42ca05e151411530d9a6ab21ebc9769d.png
吐槽
我不能理解为什么 Microsoft Word 这个软件如此难用?
我之前误打误撞把这个 Tab 符成功去掉了,但是我仅仅把缩进的参数(0.78 厘米)删除,再输入一遍 0.78 厘米,点击确定,它又出来了?
一个给用户用的软件,从用户的角度来说,相同的输入、操作却没有相同的输出(可能底层上它确实产生了不同的输入,但我们用户不可能去关心,也找不到),这是软件太烂了吗?
春暖花又开
如何去掉用户代理样式表的样式?
这是你安装的去广告插件加上的,因为选择器里面的 "adverties" 表示广告。
最好是换个名字,不然你总不能指望用户去关闭插件。
春暖花又开
/^\s+(.*?)\s+$/g 这个正则表达式什么意思?
这个正则表达式什么意思?这里"$1"代表什么?
str.replace(/^\s+(.*?)\s+$/g, "$1");
春暖花又开
为什么在router文件夹下的index.js文件里面,一开始的时候需要注册VueRouter?
怎么感觉你是把 Vue2 跟 Vue3 的两处 "use" 的写法给混在一起了呢……
Vue2 里:
Vue.use(VueRouter); // 全局的 use
const router = new VueRouter();
new Vue({ router });
Vue3 里:
const router = createRouter();
createApp().use(router); // 实例的 use
都是只有一次 "use",为啥会有两次?
***
P.S. 2 里的 "use" 是全局的,所有 Vue 实例都注入了 VueRouter(但它们可以使用不同的配置项);3 里 "use"
是单个实例的,每个 Vue 实例可以自己决定是否注入 VueRouter。
春暖花又开
ts 类型转换 as number 为何还是string?
关于ts as number 依旧是string 的问题
const props = defineProps()
getDictGroup(props.group)
export const getDictGroup = async (sid: number) => {
const dict = await getDict()
console.info(typeof sid)
sid = sid as number
console.info(typeof (sid))
console.info(typeof (sid as number))
}
我这里代码已经在每一个步骤已经声明了是 number 但是依旧打印出来时是string
但是如果我使用 parseInt(sid) 又会提示我number 类型的参数不能赋值于 string
所以 类型转换是怎么转换的呢
ts 正确的类型转换
春暖花又开
Vue项目如何实现文件下载?
在Vue项目实现文件下载的时候遇到一个问题,无论是使用a标签还是使用"windown.open(url)"都只会在网页打开预览,但是都不能下载,请问这是什么问题?应该如何去避免从而实现下载功能呢?查了好久资料,来来去去都是那一片文章抄来抄去,实在让人难受!!!这些粘贴怪真恶心!!!
春暖花又开
为什么mysql中IS TRUE和=True的结果不一样?
为什么mysql中IS TRUE和=True的结果不一样?
我有一张user表,结构如下:
"image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/c/user/20241010/3b184cf7b641490b2a606643909abbb1.png)
表中数据如下:
"image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/c/user/20241010/031487a96340f11114f63cb7d07ad56a.png)
我尝试查询sql:
SELECT * FROM `user` WHERE is_deleted IS TRUE
结果为:
"image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/c/user/20241010/7164610e7f9f7463a16b90e6218dada6.png)
查询sql:
SELECT * FROM `user` WHERE is_deleted = TRUE
结果为:
"image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/c/user/20241010/d8cd2b734fd8dc4827c4c0a2092d5e68.png)
我用true或者false作为查询条件是因为:在java中tinyint能被转成Boolean,所以在查询的时候能直接传true或者false
有没有大佬知道为什么结果不一样呢?
春暖花又开
请问大家,关于做多语言环境的小程序是如何自动切换语言的问题?
1. 用户第一次使用小程序,调用"wx.getSystemInfo"返回的语言做为默认值,同步到数据库。
2. 用户通过页面上的按钮切换语言,同步到数据库。
3. 在程序入口调用"getLanguage"获取语言来使用。
const api = {
/**
* 获取用户语言
* @return {Promise}
*/
getLanguage: () => new Promise((resolve) => {
setTimeout(() => {
/** @type {string | undefined} */
const lang = 'zh_CN';
resolve(lang);
}, 1000);
}),
};
/**
* 获取系统语言
* @return {Promise}
*/
const getSystemInfo = () => new Promise((resolve) => {
window.wx.getSystemInfo({
success: (res) => {
resolve(res.language);
},
});
});
/**
* 获取用户语言
* @return {Promise}
*/
const getLanguage = async() => {
/** @type {string} */
const defaultLanguage = 'zh_CN';
/** @type {string | undefined} */
const remoteLanguage = await api.getLanguage();
if (remoteLanguage) {
return remoteLanguage;
}
/** @type {string} */
const systemLanguage = await getSystemInfo();
if (systemLanguage) {
return systemLanguage;
}
// 兜底,不太可能发生
return defaultLanguage;
};
const main = async() => {
const language = getLanguage();
// 将language注入到全局使用或者vue-i18n这类的国际化工具
};
main();
vue组合Vue I18n的示例
import { createApp } from 'vue'
import { createI18n } from 'vue-i18n'
const main = async() => {
const language = await getLanguage();
const messages = {
zh: {
apple: '苹果',
},
en: {
apple: 'apple',
},
}
const i18n = createI18n({
locale: language,
messages,
// something vue-i18n options here ...
})
const app = createApp({
// something vue options here ...
})
app.use(i18n)
app.mount('#app')
}
"https://vue-i18n.intlify.dev/" (vue-i18n)
春暖花又开
Vue3 ts TS1109 Expression expected。为什么报这错?
WebStorm 版本太低了?不知道 TypeScript5以上版本导致的?
* "“TS1109: Expression expected” in Vue files with custom extension: WEB-57832" (https://link.segmentfault.com/?enc=ayAGx4rsfKMwV2zCqrahAQ%3D%3D.0opikdfuoHJRuL89FSM75WCnwhoDAvZgfWSVzcLY1Dn9i%2BmXBHuyWkJrQ%2FLkIGC2QJ4BwxMYFIjDlAyQ155UYP9D%2BYGI2Rpb30cNoDUyf1V4edBeTBOmTAdGll7n%2BTvYDkAXWvY3LeBycE0d2U0Jow%3D%3D)
春暖花又开
nginx ssl 报错?
nginx error.log日志一直报
SSL_read() failed (SSL: error:0A000126:SSL routines::unexpected eof while reading) while keepalive, client: 223.75.74.91, server: 0.0.0.0:443
错误,我使用pc
浏览器访问一切正常,nginx上还挂着给app访问的api接口,在app上会出现有的用户可以访问有的出问题这种情况。搜索了百度和谷歌都没找到问题所在。
https 证书是阿里云买的证书。nginx配置如下
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name xx;
root /usr/share/nginx/html;
client_max_body_size 100M;
ssl_certificate "/etc/pki/nginx/aliyun_app.yiluxq.com/xxx.pem";
ssl_certificate_key "/etc/pki/nginx/aliyun_app.yiluxq.com/xxx.key";
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
#TLS协议版本越高,HTTPS通信的安全性越高,但是相较于低版本TLS协议,高版本TLS协议对浏览器的兼容性较差。
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
#表示优先使用服务端加密套件。默认开启
ssl_prefer_server_ciphers on;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
服务器系统版本:Rocky Linux release 9.1 (Blue Onyx)
nginx版本:nginx version: nginx/1.20.1
openssl版本:OpenSSL 3.0.1 14 Dec 2021 (Library: OpenSSL 3.0.1 14 Dec 2021)
春暖花又开
Typescript体操求助,怎样得到对象的 value类型?
ts怎样得到value的类型 "['单选题','多选题','判断题',]"
const enum_option_type = {
0: '单选题',
1: '多选题',
2: '判断题',
}
春暖花又开
gke 没有统一的对外 ip 怎么设置白名单?
gke 没有统一的对外 ip 怎么设置白名单?
gke k8s 的每个 node 都有独立的公网 ip,这导致一个问题,
我在 gcp 开了一个虚拟安装了一个 redis 并设置了访问密码,但是为了安全,我还要设置一个 ip 白名单
但是我的后端程序在 gke,gke k8s 的每个 node 都有独立的公网 ip。这导致一个问题,我不知道怎么为 redis 绑定 ip
白名单了。因为我的服务会被 k8s 调度到任何一个 node,每个 node 的公网 ip 又不一样!
«为什么不走内网?运维告诉我,谷歌 gke 访问 gcp 只能公网ip 访问,也不知道真的假的?»
春暖花又开
求画电力监控拓扑图的开源库?
"BY组态" (https://link.segmentfault.com/?enc=O8bEK5I3nSEa4QWExTBDdQ%3D%3D.Qv%2FCav0OTwX%2FHDI9ZSUC5%2ByS1XYiqGu6xdO4LpkilQc%3D)
"乐吾乐" (https://link.segmentfault.com/?enc=fGGqkiijXuuRs%2FbxXrAE3w%3D%3D.EnOUBG%2BxxRkWGU3H2jYwbqxCk6eh%2BdKWbV0IpfXTEyU%3D)
可以看下这两个满足不
春暖花又开
请问如何基于命令行工具进行开发软件?
// deno run -A ping2.js
const process = Deno.run({
cmd: ["ping", "example.com"],
stdout: "piped",
stderr: "piped",
});
const { code } = await process.status();
if (code === 0) {
const rawOutput = await process.output();
const output = new TextDecoder().decode(rawOutput);
console.log(output);
} else {
const rawError = await process.stderrOutput();
const errorString = new TextDecoder().decode(rawError);
console.error(errorString);
}
process.close();
春暖花又开
VUE3 + element-plus, this.$emit失效,为什么?
VUE3 + element-plus,子组件向父组件发送消息(调用父组件函数没有反应),this.$emit方法,请大佬们帮俺看看,谢谢
"image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/c/user/20241006/6e0ef8663fc9b14269799df210e82c1f.png)
"image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/c/user/20241006/1c2ca1197e5c56e6e21b610f02e2a80d.png)
"image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/c/user/20241006/70647bdce5c5a5e8f0fb06a0dd99867a.png)
全部的代码
条件 {{": "}}-->
条件:
{{ tag }}
ShowMore
import {get_filter_type, legal_judge, zip} from '../../api/utils'
import {nextTick, ref} from 'vue'
import {ElMessage, ElMessageBox, ElInput} from 'element-plus'
import type {Action} from 'element-plus'
import {getTableData, getTableProps} from "../../api/test-data"
import customHeader from "./customHeader.vue";
import newnew from "./newnew.vue"
let click_value = ref("")
let pageSize3 = ref(20)
let currentPage3 = ref(1)
function handleSizeChange(value) {
// 页面大小改变
console.log("handleSizeChange " + value)
}
function handleCurrentChange(value) {
// 当前页码改变
console.log("handleCurrentChange " + value)
}
function log() {
console.log("stop")
}
const row_labels = getTableProps()
const tableData = getTableData()
const fixed = Array(row_labels.length)
fixed[0] = true
for (let i = 1; i >()
const select_item = [[0, '0'], [1, '1']]
const handleClose = (tag) => {
dynamicTags.value.splice(dynamicTags.value.indexOf(tag), 1)
console.log(`delete tag: ${tag}`)
}
function headClick(column, event) {
console.log(`${column.label}`)
click_value.value = column.label
}
function handleSelectionChange(value) {
console.log("handleSelectionChange" + value)
}
function conditionUpdate(data) {
/**
* @param data {column, column_filter_type, condition}
* des: 用户传来筛选条件来更新表格
*/
let {column, column_filter_type, condition} = data
let filter_type = get_filter_type()
if (column_filter_type === filter_type['text']) {
}
if (column_filter_type === filter_type['scope']) {
}
if (column_filter_type === filter_type['date']) {
}
if (column_filter_type === filter_type['select']) {
}
console.log("conditionUpdate " + data)
}
{{ column }}
-
此数据类型暂不支持查询
cancel
confirm
import {ref} from "vue";
import {get_filter_type, legal_judge} from "../../api/utils.ts";
export default {
name: "newnew",
props: ["column", "column_filter_type", "select_items"],
data() {
return {
open_flag: ref(true),
condition: {
value_start: "",
value_end: ""
},
filter_type: get_filter_type()
}
},
methods: {
confirm() {
this.open_flag = false
if (this.column_filter_type === this.filter_type['text']) {
if (!legal_judge('text', this.condition)) {
return this.$message.warning("请正确筛选条件");
}
} else if (this.column_filter_type === this.filter_type['scope']) {
if (!legal_judge('scope', this.condition)) {
return this.$message.warning("请正确筛选条件");
}
} else if (this.column_filter_type === this.filter_type['date']) {
if (!legal_judge('date', this.condition)) {
return this.$message.warning("请正确筛选条件");
}
} else if (this.column_filter_type === this.filter_type['select']) {
if (!legal_judge('select', this.condition)) {
return this.$message.warning("请正确筛选条件");
}
} else {
return null
}
console.log(this.condition.value_start)
console.log(this.condition.value_end)
this.$emit("conditionUpdate", {
column: this.column,
column_filter_type: this.column_filter_type,
condition: this.condition
})
},
}
}
百度了好久都怎么管用的,刚学不太懂
春暖花又开
React useState异步代码没有更新?
setTimeout(() => {
console.log(count, 'end'); // 还是 0!
}, 5000);
你可以把"react"组件的每次渲染理解为生成了一个平行宇宙。
初始化渲染时生成的平宇宙,其"count"值为"0",所以就算定时器延迟一年执行,它也只能输出"0"。
当你调用"setCount(count + 1)",这触发了第二次渲染,又生成了一个平行宇宙,这个平行宇宙中的"count"是"1",这个宇宙中的定时器也就只能输出"1"。
去掉定时器帮助理解
const handleClick = () => {
setCount(count + 1);
console.log(count, 'end');
}
// 两者其实是一样的,加上定时器并不会让count拥有穿透平行宇宙的能力
const handleClick = () => {
setCount(count + 1);
setTimeout(() => {
console.log(count, 'end');
}, 5000);
}
春暖花又开
后端新人关于java的项目管理工具的疑惑?
刚开始学后端,有几个问题想要请教下大家
1 是使用maven,还是IDEA的提供的intellij?不使用另一个的原因是?
2
如果是使用maven的话,是使用IDEA自带的maven,还是自己额外下载?看的一些网上教程都是让自己单独下载maven,说IDEA自带的maven不方便配置。
谢谢
春暖花又开
如何将jsp代码转换成thymeleaf语法?
首先jsp操作数据的逻辑和展示数据的逻辑是可以混在一起写的,thymeleaf一般只作为展示页面使用,不涉及对数据的操作,虽然它俩本质上都是前后端不分离,但是还是有区别的,我直接问AI把这两部分拆开写了,你可以尝试下:
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import java.util.ArrayList;
import java.util.List;
@Controller
public class MyController {
@GetMapping("/my-page")
public String myPage(Model model) {
List nr = // 初始化你的nr列表(从数据库或其他来源获取)
List bgnr = new ArrayList();
for (int ii = 0; ii " + nr.get(ii) + "");
}
// ... 实现其他逻辑,计算pcount, wpcount, flnum, lnum, elnum, nullLn, Cll, Lln等变量
// 将处理后的数据添加到Model中供前端模板使用
model.addAttribute("bgnr", bgnr);
model.addAttribute("pcount", pcount);
// ... 添加其他需要在前端展示的变量
return "my-template"; // 前端对应的Thymeleaf模板名
}
}
页面:
Total pages: