index.vue 470 B

12345678910111213141516171819202122232425262728
  1. <template>
  2. <div class="location-hash">
  3. <slot />
  4. </div>
  5. </template>
  6. <script>
  7. export default {
  8. name: 'location-hash',
  9. props: {
  10. value: {
  11. type: String | Number
  12. }
  13. },
  14. mounted() {
  15. },
  16. methods: {
  17. onChange() {
  18. this.changeHash(this.value)
  19. this.$emit('onHashChange')
  20. }
  21. },
  22. watch: {
  23. value(newValue, oldValue) {
  24. this.onChange()
  25. }
  26. }
  27. }
  28. </script>