题目描述
Java 数组扩容问题:实现动态的给数组添加元素效果,实现对数组扩容
原始数组 "int[] arr = {1,2,3}"
增加的元素 "4",直接放在数组的最后 "arr = {1,2,3,4}"
题目来源及自己的思路
1. 定义 "arr1"
2. 定义 "arr2",比 "arr1" 的长度长 "1"
3. 在 "arr1" 的长度内,把 "arr1" 的值赋值给 "arr2"
4. "arr2" 的最后一个位置赋值为 "4",也就是要加入的数据
5. 因为 "arr2" 是临时的,最终要改变的是 "arr1",
所以需要把 "arr2" 的值赋值给 "arr1"。
6. 用 "arr2" 的值覆盖 "arr1"
7. 输出查看效果
相关代码
public class AddJavaJava {
public static void main(String[] args) {
//定义arr1
int arr1[] = {1,2,3};
//定义arr2,比arr1a的长度长1
int arr2[] = new int[arr1.length+1];
//在arr1的长度内,把arr1的值赋值给arr2
for(int i = 0;i
ciiiiinema
如何把数据分割到不同的 Excel 文件中?
如下图所示,希望能在打印的时候,使头两行为重复行,数据部分,按公司名分开,显示不同公司的数据。
"image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/images/20241208/b344b69ce29d25b3d527a45d88e701ed.png)
ciiiiinema
Python 的 FastAPI 框架有没有全局数据容器?
比如 "Flask" 里的 "g" 对象,比如存储一些用户身份信息以便其它方法去使用
ciiiiinema
谁知道 Windows 下这个图标是什么程序?
最近两天突然出现的,每次都会阻止关机。
"WechatIMG9.jpg" (https://wmprod.oss-cn-shanghai.aliyuncs.com/images/20241205/8329eb77347948e31e4722a2aa1dcf6a.png)
ciiiiinema
用的虚拟主机去掉index.php存在问题?
我用的虚拟主机php的,如这个地址:
http://www.hailifuture.com/page/2.html
其实打开
http://www.hailifuture.com/index.php/page/2.html
这样才是对的,我在.htaccess中设置了
Options +FollowSymlinks -Multiviews
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L]
就成了第一个链接那样的,打开那个都是首页,这是哪里出问题了?
ciiiiinema
vue3 请求PHP后端,返回的是后端源代码,是什么问题?
https://wmprod.oss-cn-shanghai.aliyuncs.com/images/20241204/d9984eb17f52eef812bcf88c7821c0c6.png
https://wmprod.oss-cn-shanghai.aliyuncs.com/images/20241204/333d2451502a3d22f55fda12f799cd51.png
https://wmprod.oss-cn-shanghai.aliyuncs.com/images/20241204/3be0bdb08f191547ac9ba74124f556e2.png
用的vite运行vue,后端我开了环境软件,wampserver
是不是因为后端的PHP文件没有被解析???所以返回的是php的源代码???我先用的axios请求,结果是这样,后来换了XMLHttp请求还是这样,刚学vue3,卡在这了,百度了好久没找到答案,求大佬解答
ciiiiinema
各位大佬 如下图ui怎么实现?
"image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/images/20241202/dc887b8dd84e417149e8c98f390ef1cc.png)
ciiiiinema
Python 类属性 下划线的意义是什么?
双下划线比单下划线多了 Name Mangling,这是个 Python 2.0 时引入的新特性。你可以直接理解成编译器会把属性名替换成别的。
但如果你知道编译器是怎样替换的(一般来说是 "_类__属性",具体到题目中的例子就是
"_A__B"),你照样可以在外部访问到它。换而言之,它依然还是“公有”的,只是被编译器改了名字。
因此我们说 Python 并没有真正的属性可见性修饰符,下划线仅仅是约定俗成。
ciiiiinema
请问,想要忽略大小写,请问应该如何优化此代码呢?
// 搜索方法
function searchKeys(searchParam: string): string[] {
const keys: string[] = Object.keys(searchData).filter((key: string) => {
const keywords: string[] = searchData[key];
return keywords.some((keyword: string) => keyword.includes(searchParam));
});
return keys;
}
请问,想要忽略大小写,请问应该如何优化呢?
ciiiiinema
小程序canvas保存图片微信工具上和手机上样式不一样?
ctx.font = '700 15px sans-serif' //这个在微信开发工具是没有问题,但是手机上不行
// 需要添加setFontSize
ctx.setFontSize(36); // 36:字体大小 //手机上字体设置要用这个。
ctx.fillText('文案', x, y)
ciiiiinema
nodejs如何获取客户端唯一标识?
你得直接让客户端生成唯一,但是Web浏览器不允许访问底层硬件信息。不过可以使用一些前端技巧来生成一个伪唯一标识。
一种方法是使用网页存储(localStorage或sessionStorage)来存储一个生成的UUID,如果该UUID不存在,则生成一个新的并存储在网页存储中,否则就直接使用存储的UUID。这种方法的缺点是如果用户清除了浏览器数据,UUID也将被清除
另一种方法是使用网页指纹(fingerprint)技术,该技术可以通过收集浏览器、设备和操作系统等信息生成一个经过哈希处理的唯一识别码。你可以使用"https://github.com/fingerprintjs/fingerprintjs"
这个库纯前端实现的浏览器指纹采集器,通过获取浏览器中所有能获取到的信息(部分通过base64转成String),最后生成出md5,用于该用户在该设备上的唯一标识码,准确度99.5%,够用了
ciiiiinema
使用Apache iotdb保存物联网设备, 数据库创建问题?
你设备什么数量级、设备测点什么数量级,你要有瓶颈了再逻辑分库也行,但也不是一个设备一个数据库,我不知道你统计不同设备的聚合量怎么办
ciiiiinema
vue正式环境如何能配置多个请求的url?
vue项目 打包放到服务器上之后 如何能做到 模块1 请求www.xxx1.com的接口,模块2请求www.xxx2.com的接口.... ..
这种能实现吗?需要怎么配置 动态配置
ciiiiinema
前后端上传文件,后端不能使用file类接收?
springboot接收前端上传到后端的文件时,在controller层内大多数使用的是"MultipartFile"进行接收的,当使用file进行接收时会报错
有大佬知道为啥 不能用file接收文件吗?
ciiiiinema
AMH中指定外部数据库的方法?
AMH看起来是PHP程序相应,能否安装时候选择不安装MySQL这些?指定外部数据库,以达到更小的资源占用?
无
ciiiiinema
如何在Java中实现调用B接口时监听A接口执行状态?
最简单的方法,一个线程,先调用 A,再调用 B
如果是从一个线程里开始的异步,调用 A 返回个 Future,调用 B 的时候检查 Future 状态
如果不是一个线程里开始的,做一个全局变更标记一下
如果不是一个程序的…算了其实都一样
ciiiiinema
请教一下,spring boot下,如何获取加网关代理的nacos配置?
基本环境:
1. 根据手册,本地搭建一个nacos server, 版本 2.2.3, standalone
2. 利用apisix,给nacos server加一层网关代理{
"uri": "/nacos/*",
"name": "local.8848",
"upstream_id": "xx",
"enable_websocket": true,
"status": 1
}
{
"nodes": [
{
"host": "host.docker.internal",
"port": 8848,
"weight": 100
}
],
"type": "roundrobin",
"pass_host": "pass",
"name": "local.nacos"
}
访问:
"http://localhost:9080/nacos/index.html"
都很正常的,也可以用
curl -X GET "http://localhost:9080/nacos/v1/cs/configs?dataId=nacos.cfg.dataId"
配置了值:
namespace=public
dataId=nacos.cfg.dataId
group=DEFAULT_GROUP
value: // properties
time.pattern=yyyy-mm-dd
目前问题是:
1. 用spring boot读取不到配置
spring boot里的配置就非常简单,
nacos.config.server-addr=http://localhost:9080
spring boot代码:
// 版本
0.2.12
@SpringBootApplication
@NacosPropertySource(dataId = "nacos.cfg.dataId", type = ConfigType.PROPERTIES, autoRefreshed = true)
public class NacosConfigApplication {
public static void main(String[] args) {
SpringApplication.run(NacosConfigApplication.class, args);
}
}
@Controller
public class ConfigController {
@NacosValue(value = "${time.pattern}", autoRefreshed = true)
private String value;
@RequestMapping(value = "/config/get", method = GET)
@ResponseBody
public String get() {
return value;
}
}
直接用sdk也不行
com.alibaba.nacos
nacos-client
2.3.0 // 2.2.3, 2.2.4都试过
public static void main(String[] args) throws Exception {
String serverAddr = "http://localhost:9080"; 就可以了
String dataId = "nacos.cfg.dataId";
String group = "DEFAULT_GROUP";
Properties properties = new Properties();
properties.put(PropertyKeyConst.SERVER_ADDR, serverAddr);
ConfigService configService = NacosFactory.createConfigService(properties);
String content = configService.getConfig(dataId, group, 5000);
// 换成 serverAddr=http://localhost:8848, content就是配置的值了
System.out.println(content); // content=null,
}
ciiiiinema
nuxt3 请求 token 要怎么传?
以前一直用 "vue3",现在在学习用 "nuxt3",遇到一个传 "token" 的问题,研究半天没明白,"nuxt3" 这个 "token"
要怎么请求的时候传过去?
我先讲下我的 "vue3" 是怎么用的
用户第一次访问网站,检查 "localStorage.getItem('token')"
是否为空,如果为空或"token"过时,直接跳到登录页面,登录后获取 "token" 存放到 "localStorage.setItem('token', token)" 里面,之后每次页面的所有请求都在 "headers.Authorization" 里面带上,如下:
import axios from 'axios';
axios.post('/api/users', {
headers: {
Authorization: 'Bearer ' + localStorage.getItem('token')
}
}).then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error);
});
那 "nuxt3" 获取的 "token" 放在哪,怎么在下面请求中带上?
const { data } = await useFetch('/api/users');
"xxx.vue" 文件中,更本就不能使用 "localStorage",该怎么做?
网上都说用用 "useState",
// states.ts
export const useToken = () => useState('token', () => '');
登录后获取 "token",存到 "useToken().value = token" 里面,那我刷新页面不就没了
ciiiiinema
vue2中v-model绑定的属性为动态的,请问应该如何绑定?
示例代码如下:
export default {
data() {
return {
processInfo: {
name: '主项目',
children: [
{
name: '子项目',
personList: [
{
personName: '张三'
}
]
}
]
},
key: 'children[0].personList[0].personName',
}
}
}
我想通过key动态的绑定processInfo的属性,但是这样不生效,请问各位大佬有什么解决办法?
ciiiiinema
Sentinel的漏桶算法限流实现是不是不太准?
"https://blog.csdn.net/xiaoyi5224765/article/details/115706271" (https://link.segmentfault.com/?enc=JN1bJFpUL6zygFUXBNYt7Q%3D%3D.PZshLLmlsOJIz0V9gkCwB%2FkzLvBglDt3Ozp9PtWQSF2DDHZbpXaFpHHC5io4GiQtFummkaFauvelZwuL3Yfjpw%3D%3D)
为什么这个Sentinel的 漏桶算法 限流 RateLimiterController 的实现中:
if (expectedTime <= currentTime) {//@5
// Contention may exist here, but it's okay.
latestPassedTime.set(currentTime);
return true;
} else {
}
期望时间小于当前时间 则放行, 这个代码存在并发的情况,怎么他还 is ok? 这玩意是不是不准?
没保证只有一个线程成功更新latestPassedTime。
b
ciiiiinema
寻找windows锁住鼠标跟键盘工具?
建议直接机箱上锁,禁止外联设备。
ciiiiinema
如果把设计的png图片在保证效果的前题下存储空间尽量减少?
"https://tinypng.com" (https://link.segmentfault.com/?enc=RvntftOU8LDtEuyjVvISIw%3D%3D.%2Bf%2F4fRvP9jNCb0SR%2F3Q2okJJPWduUpnnx1AJJ93OO4M%3D)
我经常用的这个
ciiiiinema
网页视频暂停后无法播放,重启可解决?
B站网页视频暂停后再播放就会一直缓冲.网络良好不卡,换浏览器也不行。
只有重启可以解决问题
ciiiiinema
react reducer中如何异步更新数据?
export enum actionType {
updateData = 'updateData',
}
export const initData = {
data: {}
}
const update = () => {
const age = 'xxx'
let name = 'xxxx'
// 这里模拟异步请求
setTimeout(() => {
name = '异步数据'
}, 2000)
return {
age,
name,
}
}
export const passengerReducer = (state, action) => {
const data = update()
switch (action.type) {
case actionType.updateData:
return {
...state,
data,
}
default:
return state
}
}
// 外部调用
dispatch({
type: updateData
})
之前"name"的更新是同步更新的没有问题现在需要走接口,等接口返回后再更新,我试过在这个文件中调用"dispath"但是调用报错,请问下这种异步的数据该怎么更新
ciiiiinema
阿里云备案为什么不能填写网站的备案信息?
阿里云域名备案,显示实名认证成功了,却还是不能完成信息填写,这是什么原因啊,距离实名认证成功已经过去三天了,是我操作有问题,还是我应该再等等啊?
"6b849bb97a191559239d9fcf0adbefa1.jpg" (https://wmlx-new-image.oss-cn-shanghai.aliyuncs.com/images/20241031/4a4bb337feb20259f4f6f5eb03a18aec.png)
这里说是工信部系统未核实到,是应该先去工信部进行备案吗?
自己搜索了一些方法,确实不知道原因。
ciiiiinema
vue上传文件一直报错,该配的也写上了,但是一直上传不上去,这是为什么呢?
1. CORS 是跨域问题
2. 服务器需要配置响应头,许可你的请求中包含的各种东西,比如 header、比如 method,等等
3. 跨域请求会先发送一个 preflight 请求,即用 "OPTIONS" 请求接口,需确认服务器可以正常响应此请求,并返回正确的响应体
4. "withCredentials" 只负责传递 cookie 信息,并不解决跨域
ciiiiinema
uni-simple-router的vue3版本跳转传值params拿不到?
我用的uniapp,但用的vue3,购买的uni-simple-router的vue3版本,
import {reactive,computed} from 'vue'
import {onShow} from '@dcloudio/uni-app'
import router from '@/router'
其中 import router from '@/router'的代码为:
import {createRouter,toIsNewWindow} from '@/uni-simple-router'
import {routes} from './routes'
import {nextTick,createApp} from 'vue'
import {timeOut} from '~@/utils/index.js'
import FloatLayerCom from '@/components/float-layer.vue'
import {isEmpty,isWechat} from "@/utils/filter.js"
import BASE_URL from '@/utils/env.js'
// #ifdef H5
const floatLayerApp = createApp(FloatLayerCom);
const mountEl = document.createElement(`div`);
mountEl.id="floatLayerApp";
document.body.appendChild(mountEl);
floatLayerApp.mount(`#floatLayerApp`)
// #endif
function androidQuitApp(){
uni.showModal({
title: '退出应用',
content: `你确定要退出本应用?`,
success: ({confirm})=>{
confirm && plus.runtime.quit();
}
});
}
function changeFloat(status,to){
// #ifdef H5
if(to.navType!==`back`){
floatLayerApp._instance.setupState.toggleFloat(status);
}
// #endif
}
/**
* 是否开启随机动画
*/
const randomAnimation = true;
const router = createRouter({
platform: process.env.VUE_APP_PLATFORM,
routeNotFound:(to)=>{
return {
name:`404`,
navType:`push`
}
},
applet:{
launchedHook:()=>{
console.log(`首页进入成功`)
},
// hideHomeButton:true
},
app:{
setSideSlipGesture:(to)=>{
return `close`
},
runtimeQuit:androidQuitApp
},
h5:{
animation:{
includeNavtype:[`push`,`back`,`replace`],
animationTime:0,
animationAppEl:(to,from)=>{
if(toIsNewWindow(to,from)){
return document.querySelector(`#app`)
}
if(to.meta && to?.meta?.animationEl && to?.meta?.navType === to.navType){
return document.querySelector(to.meta.animationEl)
}
return null
},
defaultAnimationType:(to)=>{
let animationType = `animate__slideInRight`;
if(randomAnimation){
const animationNode = [
`animate__slideInRight`,
`animate__bounceInRight`,
`animate__rotateInDownLeft`,
`animate__zoomInDown`
]
animationType = animationNode[
parseInt(
Math.random()*animationNode.length
)
]
}
if(to?.meta?.animation && to?.meta?.navType === to.navType){
animationType = to.meta.animation
}
return animationType
},
animationNodeMap:{
'animate__slideInRight':[
// 前进
[`animate__slideInRight`,`animate__slideOutLeft`],
// 后退
[`animate__slideInLeft`,`animate__slideOutRight`],
],
'animate__bounceInRight':[
// 前进
[`animate__bounceInRight`,`animate__bounceOutLeft`],
// 后退
[`animate__bounceInLeft`,`animate__bounceOutRight`],
],
'animate__rotateInDownLeft':[
// 前进
[`animate__rotateInDownLeft`,`animate__rotateOutDownLeft`],
// 后退
[`animate__rotateInDownRight`,`animate__rotateOutDownRight`],
],
'animate__zoomInDown':[
// 前进
[`animate__zoomInDown`,`animate__zoomOutDown`],
// 后退
[`animate__zoomInUp`,`animate__zoomOutDown`],
],
// 给路由定义的动画
'child_router_animate':[
// 前进
[`animate__slideInUp`]
]
}
}
},
routes,
})
let appRunCount = 0
//全局路由前置守卫
router.beforeEach(async (to,from)=>{
console.error(`------- beforeEach守卫执行 ------`)
console.log(to)
console.log(from)
changeFloat(`load`,to);
if (to.path.indexOf("/api/") > 0) {
return true;
return;
}
if (to.name == "wxauth") { //微信授权
return true;
return;
}
if (to.name == "wxauthmp") { //微信小程序授权
return true;
return;
}
let token = uni.getStorageSync("token")
//token='Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI2MDQwOSIsImlhdCI6IjE2OTU3Nzk4NTAiLCJuYmYiOiIxNjk1Nzc5ODUwIiwiZXhwIjoiMTcwMDk2Mzg1MCIsImh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vd3MvMjAwOC8wNi9pZGVudGl0eS9jbGFpbXMvZXhwaXJhdGlvbiI6IjIwMjMvMTEvMjYgOTo1NzozMCIsImlzcyI6IlN5c3RlbSIsImF1ZCI6IlVzZXIiLCJodHRwOi8vc2NoZW1hcy5taWNyb3NvZnQuY29tL3dzLzIwMDgvMDYvaWRlbnRpdHkvY2xhaW1zL3JvbGUiOiIxIiwiVXNlcklkIjoiNjA0MDkiLCJPcGVuSWQiOiJvemRIVjVYMjRaMmNWV2M4dmJ5UUN5M3FodU5BIiwiU291cmNlIjoiMSJ9.ukSbwH5deboT7ohLCwpA8EU0y2um4iQmdbEpyjpWj3g'
if (isEmpty(token)) {
// 保存当前路由地址,授权后还会跳到此地址
//#ifdef H5
/*
if (isWechat()) {
console.log('微信公众号授权处理');
uni.setStorageSync('wxRedirectUrl', to.fullPath);
uni.request({
url: BASE_URL + "/WX/GetAuthCode",
method: "POST",
success: (res) => {
if (res.data.Code == 0) {
console.log("地址来源:" + to.name);
console.log(res.data.Msg);
alert("该功能目前只支持在'支付宝'端使用")
//window.location.href = res.data.Msg
} else {
return true;
return;
}
}
})
} else {
console.log('支付宝生活号H5授权处理');
uni.setStorageSync('wxRedirectUrl', to.fullPath);
uni.request({
url: BASE_URL + "/ZFB/GetAuthCode",
method: "POST",
success: (res) => {
if (res.data.Code == 0) {
console.log(res.data.Msg);
window.location.href = res.data.Msg
} else {
return true;
return;
}
}
})
}
*/
//#endif
} else {
return true;
}
})
// 全局路由后置守卫
router.afterEach(async (to,from)=>{
console.error(`++++++ afterEach守卫执行 +++++++`)
console.log(router)
changeFloat(`success`,to);
if(to.meta && to.meta.title){
// #ifdef H5
await timeOut(1)
// #endif
uni.setNavigationBarTitle({
title:to.meta.title
})
}
})
router.onError(e=>{
console.log(e)
})
export default router
我现在想点击链接跳转时带参数:
const goNotice=(row)=>{
console.log(row)
router.push({
name:'notice',
params:{"id":2323}
})
}
接受页面死活拿不到params的值:
import {reactive,computed,watch,onMounted} from 'vue'
import {onShow} from '@dcloudio/uni-app'
import BaseTab from '@/pages/common/base-tabbar.vue'
import leftArrow from '@/pages/common/leftArrow.vue'
import * as api from '@/utils/api.js'
import {timeOut} from '~@/utils/index.js'
import router from '@/router'
import {useRoute} from '@/uni-simple-router'
const route = useRoute()
const data=reactive({
})
onShow(()=>{
console.log('onShow')
console.log("xxxxx")
console.log(route.value)
})
"image.png" (https://wmlx-new-image.oss-cn-shanghai.aliyuncs.com/images/20241030/d773d006d021316f72df212a348c2749.png)
做了各种尝试,就是不行。
ciiiiinema
导入新项目,执行脚本命令出错,该如何运行?
注意到安装时出现
npm ERR! cb() never called!
在本站查到这个问题
"https://segmentfault.com/q/1010000042608502" (https://segmentfault.com/q/1010000042608502)
使用npm install --no-package-lock 解决了
ciiiiinema
spring jpa 针对复合主键如何通过 @Query 查询?
spring jpa 针对复合主键如何通过 @Query 查询?
@Query("select count(id) from UserRecommendedEntity where id.userId = :userId and isLike = :isLike")
int countByUserIdAndIsLike(Long userId, int isLike);
上面代码ide会提示无法解析的字段 "id.userId"。我的 UserRecommendedEntity 代码如下:
@Data
@Accessors(chain = true)
@Entity
@Table(name = "user_recommended")
public class UserRecommendedEntity {
@EmbeddedId
private UnionId id;
@Column(name = "is_like")
private Integer isLike;
@Column(name = "created_at")
private String createdAt;
@Data
public static class UnionId implements Serializable {
@Column(name = "user_id")
private Long userId;
@Column(name = "recommended_user_id")
private Long recommendedUserId;
}
}
无
ciiiiinema
使用 apache 服务器执行 python 的 cgi 脚本时出现中文乱码?
https://wmlx-new-image.oss-cn-shanghai.aliyuncs.com/images/20241025/a996de882937f3fddb741c451c60d514.png
这是 apache 服务器配上 python 脚本。改了以下的配置
ScriptAlias /cgi-bin/ "D:/DemoProject/apache/www/"
AllowOverride None
Options +ExecCGI
# Order allow,deny
# Allow from all
Require all granted
AddHandler cgi-script .cgi .pl .py
脚本文件是使用 utf-8 格式的,当出现中文乱码时,我试着把 print ('')
这行注释掉,这个时候发现没有问题了。而一般设置
就是防止中文乱码的,而这里却相反,注释掉后反而正常显示,请问一下为什么会这样?
ciiiiinema
如何可以模拟让Vue项目编译运行的很慢?
没有理解为什么要减缓编译速度,最简单的就是限制CPU的功率之类的,比如说开启节电模式。
ciiiiinema
解决Nginx代理多个Node.js Express服务的问题,另一个为什么代理不了?
当本地起了2个node express服务,用nginx配置proxy_pass时候。只能代理成功第一个,第二个代理不成功,什么原因。
配置如:
server {
listen 80;
server_name your_domain.com;
location /app1 {
proxy_pass http://localhost:3001;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location /app2 {
proxy_pass http://localhost:3002;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# 可以添加更多的 location 块来配置更多的应用程序
# 其他配置...
}
ciiiiinema
rollup打包,如何处理 Symbol.toPrimitive ?
通过rollup打包"test.js",打包后文件中出现Symbol关键字
源文件:test.js
class A{}
export default A;
打包后文件:test.min.js
var A = function () {
"use strict";
...其他代码-- var e = r[Symbol.toPrimitive];
...其他代码-- }
rollup配置文件:rollup.config.js
import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import babel from "@rollup/plugin-babel";
import json from "@rollup/plugin-json";
import {terser} from "rollup-plugin-terser";
export default {
input: ["./src/test.js"],
output: {
file: "./out/test.min.js",
format: "iife",
name: "A",
},
plugins: [resolve(), commonjs(), babel(), json(), terser()],
};
期望能够不生成"Symbol.toPrimitive"或者生成"Symbol"的polyfill。能在不支持ES6环境正常运行
ciiiiinema
Jenkins在Windows容器中调用Docker命令的配置方法?
请问运行在容器内的Jenkins如何配置可以调用docker命令?宿主机是Windows系统。
首先排除制作一个带有docker的Jenkins的镜像,这个办法有点老套。
尝试了一下docker in docker,但是貌似这个方案是基于Linux的。
在Windows上docker本身已经运行于wsl这类的虚拟机中了,如何再映射卷呢?
尝试过docker in docker,但是-v
/var/run/docker.sock:/var/run/docker.sock这种命令在Windows的docker无法使用。
ciiiiinema
nuxt2框架如何使用vue的事件总线?
nuxt2框架如何使用vue的事件总线哦,为啥我拿不到this.$bus.$emit哦,
求救求救
不管是在created还是在mounted生命周期,都拿不到
ciiiiinema
哪有electron的最新的教程?
哪里有electron的最新教程呀?我在bilibili,百度上搜索发现都是比较早的教程,在youtube上搜索发现教程都更早,哪里有最近的electron的教程?electron现在没人用了吗?
ciiiiinema
如何为一个组件同时绑定单击和双击事件?
如何为一个组件同时绑定单击和双击事件
ciiiiinema
后端返回的id因为过大导致 精度丢失 导致前端打印显示与后端返回的数据id不一致 问题?
各位大佬 后端返回的id因为过大导致 精度丢失 导致前端打印显示与后端返回的数据id不一致 问题 如何解决
主要是后端如何解决 前端解决也可以给出有效方案,谢谢!
希望可以解决"image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/c/user/20241012/c3983667e7b91fa3a6efb90757acf0b7.png)前端打印的数据
"image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/c/user/20241012/512bdd7d1a2460f1a4290c865c264b48.png)后端实际数据
ciiiiinema
monorepo 路径别名问题,如何配置?
如下图的拓扑图所示,common是a,b,c三个项目公共引用的,如何给这个common配置路径别名,并且配置后引用它的a,b,c也可以同样生效的?
root
├── package.json
├── pnpm-workspace.yaml
├── packages
├── common
├── package.json
├── utils
├── package.json
├── A
├── package.json
├── B
├── package.json
├── C
├── package.json