default.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <template>
  2. <div class="com-body">
  3. <pc-header></pc-header>
  4. <nuxt />
  5. <pc-footer></pc-footer>
  6. <loginDialog></loginDialog>
  7. </div>
  8. </template>
  9. <script>
  10. import { removeKeyboardKey, addKeyboardKey } from '@/utils/keyboard'
  11. export default {
  12. mounted() {
  13. // this.openZoho()
  14. // 添加监听
  15. window.addEventListener('keydown', addKeyboardKey)
  16. window.addEventListener('keyup', removeKeyboardKey)
  17. // 记住添加事件和卸载事件老是成对存在
  18. this.$once('hook:beforeDestroy', () => {
  19. window.removeEventListener('keydown', addKeyboardKey)
  20. window.removeEventListener('keyup', removeKeyboardKey)
  21. })
  22. },
  23. methods: {
  24. openZoho() {
  25. window.$zoho = window.$zoho || {}
  26. // eslint-disable-next-line
  27. $zoho.salesiq = $zoho.salesiq || {
  28. widgetcode:
  29. 'c5155e8cbfdb63f0a2b6f6f2cd50bdf2d3a9287755a068674324ed7d483e092e1baa6b2e7ee5c67d53c187e030d5c1f5',
  30. values: {},
  31. ready: function () {},
  32. }
  33. let d = document
  34. let s = d.createElement('script')
  35. s.type = 'text/javascript'
  36. s.id = 'zsiqscript'
  37. s.defer = true
  38. s.src = 'https://salesiq.zoho.com/widget'
  39. let t = d.getElementsByTagName('script')[0]
  40. t.parentNode.insertBefore(s, t)
  41. d.write("<div id='zsiqwidget'></div>")
  42. }
  43. },
  44. }
  45. </script>
  46. <style lang="scss" scoped>
  47. </style>