index.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import Vue from 'vue'
  2. import Rules from './rules.vue'
  3. import i18n from '@/util/lang/lang'
  4. const RulesConstructor = Vue.extend(Rules)
  5. Rules.install = function (Vue) {
  6. // Vue.component(Rules.name, Rules);
  7. }
  8. let instance
  9. Rules.show = (title, content) => {
  10. if (!instance) {
  11. instance = new RulesConstructor({
  12. el: document.createElement('div'),
  13. data () {
  14. return {
  15. visible: true,
  16. showTitle: title,
  17. showContent: content
  18. }
  19. },
  20. i18n
  21. })
  22. document.body.appendChild(instance.$el)
  23. } else {
  24. instance.visible = true
  25. instance.showTitle = title
  26. instance.showContent = content
  27. }
  28. }
  29. /**
  30. * 显示游戏规则
  31. */
  32. Rules.showRules = () => {
  33. Rules.show('title1', 'content1')
  34. }
  35. /**
  36. * 显示GT规则
  37. */
  38. Rules.showGTRules = () => {
  39. Rules.show('title2', 'content2')
  40. }
  41. /**
  42. * 显示充值说明
  43. */
  44. Rules.showIntroRules = () => {
  45. Rules.show('title3', 'content3')
  46. }
  47. Rules.hide = () => {
  48. if (instance) {
  49. instance.visible = false
  50. }
  51. }
  52. export default Rules