Bookmark.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <template>
  2. <q-btn class="bookmark-btn"
  3. rounded
  4. :flat="!color"
  5. :color="color"
  6. :loading="loading"
  7. :icon="isFavored ? 'isax:bookmark5' : 'isax:bookmark4'"
  8. @click="bookmark">
  9. <q-tooltip anchor="top middle"
  10. self="bottom middle"
  11. :offset="[10, 10]">
  12. نشان کردن
  13. </q-tooltip>
  14. <!-- <svg :class="isFavored ? 'hide' : ''"-->
  15. <!-- class="btnFavorite-off"-->
  16. <!-- width="24"-->
  17. <!-- height="24"-->
  18. <!-- viewBox="0 0 24 24"-->
  19. <!-- fill="none"-->
  20. <!-- xmlns="http://www.w3.org/2000/svg">-->
  21. <!-- <path d="M15.4162 2C18.678 2 20.3089 3.6472 20.3089 6.94159V18.4394C20.3089 21.6848 18.0093 22.9406 15.1879 21.2445L13.0351 19.9398C12.5459 19.6462 11.763 19.6462 11.2738 19.9398L9.12099 21.2445C6.29955 22.9406 4 21.6848 4 18.4394V6.94159C4 3.6472 5.63089 2 8.89267 2H15.4162Z"-->
  22. <!-- stroke="#292D32"-->
  23. <!-- stroke-width="1.5"-->
  24. <!-- stroke-linecap="round"-->
  25. <!-- stroke-linejoin="round" />-->
  26. <!-- </svg>-->
  27. <!-- <svg class="btnFavorite-on"-->
  28. <!-- :class="isFavored ? '' : 'hide'"-->
  29. <!-- width="24"-->
  30. <!-- height="24"-->
  31. <!-- viewBox="0 0 24 24"-->
  32. <!-- fill="none"-->
  33. <!-- xmlns="http://www.w3.org/2000/svg">-->
  34. <!-- <path d="M15.4162 2C18.678 2 20.3089 3.6472 20.3089 6.94159V18.4394C20.3089 21.6848 18.0093 22.9406 15.1879 21.2445L13.0351 19.9398C12.5459 19.6462 11.763 19.6462 11.2738 19.9398L9.12099 21.2445C6.29955 22.9406 4 21.6848 4 18.4394V6.94159C4 3.6472 5.63089 2 8.89267 2H15.4162Z"-->
  35. <!-- fill="#292D32"-->
  36. <!-- stroke="#292D32"-->
  37. <!-- stroke-width="1.5"-->
  38. <!-- stroke-linecap="round"-->
  39. <!-- stroke-linejoin="round" />-->
  40. <!-- </svg>-->
  41. <template v-slot:loading>
  42. <q-spinner color="primary" />
  43. </template>
  44. </q-btn>
  45. </template>
  46. <script>
  47. export default {
  48. name: 'Bookmark',
  49. props: {
  50. isFavored: {
  51. default: false,
  52. type: Boolean
  53. },
  54. loading: {
  55. default: false,
  56. type: Boolean
  57. },
  58. color: {
  59. default: undefined,
  60. type: String
  61. }
  62. },
  63. emits: [
  64. 'update:value',
  65. 'clicked'
  66. ],
  67. data () {
  68. return {}
  69. },
  70. computed: {
  71. isUserLogin () {
  72. return this.$store.getters['Auth/isUserLogin']
  73. }
  74. },
  75. methods: {
  76. bookmark () {
  77. this.$emit('clicked')
  78. if (!this.isUserLogin) {
  79. this.$store.commit('Auth/updateRedirectTo', { name: this.$route.name, params: this.$route.params })
  80. this.$store.commit('AppLayout/updateLoginDialog', true)
  81. }
  82. }
  83. }
  84. }
  85. </script>
  86. <style scoped lang="scss">
  87. .bookmark-btn {
  88. z-index: 1000;
  89. padding: 5px;
  90. margin: 5px;
  91. }
  92. .hide{
  93. display: none;
  94. }
  95. .btnFavorite-off {
  96. width: 20px;
  97. height: 20px;
  98. }
  99. </style>
  100. <style lang="scss"></style>