推送通知声音在 Chrome 浏览器中不起作用

时间:2020-12-19 06:35:01

标签: javascript php laravel vue.js pusher

推送通知声音在 Chrome 浏览器中不起作用。 我知道 order play() 策略已更改。但是如何绕过它并使用通知声音? 我正在使用 Laravel 7 Pictures of chrome browser error

Here is my Vue js code

<script>
export default {
  props: ["dataAuthUser"],
  data() {
    return {
      unreadNotifications: "",
      //   readNotifications: "",
      user: JSON.parse(this.dataAuthUser),
      alart: new Audio("/alert/alert.mp3"),
    };
  },
  created() {
    axios
      .get("/admin/vue-notify")
      .then((res) => {
        // console.log(res);
        this.unreadNotifications = res.data.unreadNotifications;
        // this.readNotifications = res.data.readNotifications;
        // this.playSound();
      })
      .catch((err) => {});
    console.error(err);
  },
  mounted() {
    Echo.private("App.User." + this.user.id).notification((notification) => {
      this.unreadNotifications.unshift(notification);
      return this.alart.play();
    });
  },
  methods: {},
  watch: {},
};
</script>


    

1 个答案:

答案 0 :(得分:0)

相关问题