Skip to content

Commit

Permalink
feat: update
Browse files Browse the repository at this point in the history
  • Loading branch information
dogodo-cc committed Aug 9, 2024
1 parent 950ad12 commit cd51518
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
registry=https://registry.npmmirror.com
#registry=https://registry.npmjs.org
@cocos-fe:registry=https://registry.npmjs.org
@editor:registry=http://creator-npm.cocos.org:7001/
@editor:registry=http://creator-npm.cocos.org:7001/

electron_mirror=https://npmmirror.com/mirrors/electron/
ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/
4 changes: 2 additions & 2 deletions packages/electron-badge/main/src/badge-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ export default class BadgeGenerator {

generate(value: string, opts?: Partial<IbadgeStyleOpt>) {
const styleOpts = JSON.stringify({ ...this.style, ...opts });

return this.win.webContents.executeJavaScript(`window.drawBadge(${value}, ${styleOpts});`, true);
// 注意:字符串需要用 '' 包裹, 对象用 JSON.stringify
return this.win.webContents.executeJavaScript(`window.drawBadge('${value}', ${styleOpts});`);
}

// 这个函数会被注入到渲染进程
Expand Down

0 comments on commit cd51518

Please sign in to comment.