首页 > 解决方案 > node-notifier snoretoast 按钮文本如何支持中文

问题描述

notifier.removeAllListeners();
  notifier.notify(
    {
      message: 'Hello',
      wait: true,
      timeout: false,
      actions: ['确认', '取消'],
    },
    function (err, data) {
      // Will also wait until notification is closed.
      console.log('Waited');
      console.log('确认');
      console.log(err, data);
      // if(`${data}`.toString('utf8le') == '确认') {
      //   console.log('866666633333333')
      // }
    }
  );
  notifier.on('activate', () => {
    console.log('Clicked!');
  });
  notifier.on('dismissed', () => {
    console.log('Dismissed!');
  });
  // Buttons actions (lower-case):
  notifier.on('确认', () => {
    console.log('"Ok" was pressed');
  });
  notifier.on('取消', () => {
    console.log('"Cancel" was pressed');
  });

如果我使用中文,则不会执行相应的事件。应该是buff转换后激活类型发生了变化。如何解决这个问题呢。请帮我。谢谢你。 在此处输入图像描述

更多信息可以在这里找到在这里输入链接描述

标签: electronnode-notifier

解决方案


推荐阅读