我有以下用于从后端下载 PDF 文件的代码:
const link = document.createElement('a')
link.href = URL.createObjectURL(blob)
link.setAttribute('target', '_blank')
link.setAttribute('download', file_name)
link.click()
link.remove()
setTimeout(() => window.URL.revokeObjectURL(url), 100)
Run Code Online (Sandbox Code Playgroud)
它在 Chrome 中按预期工作,我相信它以前在 Firefox 中工作,但现在 Firefox 在同一选项卡中打开文件而不是下载,忽略目标和下载属性。
我已经尝试将其作为自定义指令,但 JS 拒绝任何字符串中的脚本标记(未终止的文字字符串)。此外,vue-google-adsense 和 vue-adsense 插件对我不起作用,因为它们没有获得 Adsense 提供的所有参数,因此广告变得没有响应等。
我正在尝试使用 Turborepo 制作 monorepo。我在那里有很多 Vue 项目,我需要在所有应用程序之间共享 Vite 配置。以下是我试图实现这一目标的方法。
我有一个名为@monorepo/configs:
packages/
configs/
package.json
index.ts
vite.config.base.ts
Run Code Online (Sandbox Code Playgroud)
包.json:
{
"name": "@monorepo/configs",
"version": "0.0.1",
"private": true,
"type": "module",
"main": "index.ts",
"types": "index.ts",
"files": [
"./src/tsconfig.base.json",
"./src/vite.config.base.js"
]
}
Run Code Online (Sandbox Code Playgroud)
vite.config.base.ts:
import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
// regular config
export const ViteConfigBase = defineConfig({
resolve: {
alias: {
// some aliases
}
}
})
Run Code Online (Sandbox Code Playgroud)
索引.ts:
export { ViteConfigBase } from './vite.config.base'
Run Code Online (Sandbox Code Playgroud)
在另一个应用程序的 vite.config.ts 中:
import { …Run Code Online (Sandbox Code Playgroud) 之前我们手动处理所有 auth0 逻辑,将用户信息保存在 cookie 中,自己处理所有刷新逻辑等。现在由于迁移到 vue 3,我们切换到 auth0-vue,但是我们有 e2e 测试,需要测试新用户flow,以前我们只需替换 cookie 就可以了 - 无需每次都创建新用户。但现在,当所有身份验证逻辑都发生在插件的底层时,就不可能以同样的方式做到这一点。但我们不想每次都注册一个新用户并造成不必要的混乱,并且绝对不想回滚到手动处理所有内容。
\n关于如何解决它有什么想法吗?
\njavascript ×3
adsense ×1
auth0 ×1
firefox ×1
monorepo ×1
playwright ×1
turborepo ×1
vite ×1
vue.js ×1
vuejs3 ×1