LibsPage.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <template>
  2. <div></div>
  3. </template>
  4. <script>
  5. //-----------------------------------------------------------------------------
  6. import Vue from 'vue';
  7. import Component from 'vue-class-component';
  8. import Window from '../../share/Window.vue';
  9. import * as utils from '../../../share/utils';
  10. //import rstore from '../../../store/modules/reader';
  11. export default @Component({
  12. components: {
  13. Window
  14. },
  15. watch: {
  16. libs: function() {
  17. this.loadLibs();
  18. },
  19. }
  20. })
  21. class LibsPage extends Vue {
  22. created() {
  23. this.popupWindow = null;
  24. this.commit = this.$store.commit;
  25. //this.commit('reader/setLibs', rstore.libsDefaults);
  26. }
  27. init() {
  28. this.popupWindow = window.open(`http://${window.location.host}/?p=external-libs#/external-libs`);
  29. if (this.popupWindow) {
  30. //Проверка закрытия окна
  31. (async() => {
  32. while(this.popupWindow) {
  33. if (this.popupWindow && this.popupWindow.closed)
  34. this.close();
  35. await utils.sleep(1000);
  36. }
  37. })();
  38. }
  39. this.loadLibs();
  40. }
  41. done() {
  42. if (this.popupWindow) {
  43. this.popupWindow.close();
  44. this.popupWindow = null;
  45. }
  46. }
  47. get libs() {
  48. return this.$store.state.reader.libs;
  49. }
  50. loadLibs() {
  51. }
  52. /* submitUrl() {
  53. if (this.bookUrl) {
  54. this.$emit('load-book', {url: this.addProtocol(this.bookUrl), force: true});
  55. this.bookUrl = '';
  56. }
  57. }*/
  58. close() {
  59. this.$emit('libs-close');
  60. }
  61. }
  62. //-----------------------------------------------------------------------------
  63. </script>
  64. <style scoped>
  65. .separator {
  66. height: 1px;
  67. background-color: #A0A0A0;
  68. }
  69. </style>