navBar.vue 776 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <template>
  2. <pyh-nv :config="config"></pyh-nv>
  3. </template>
  4. <script setup>
  5. import {
  6. ref,
  7. defineProps,
  8. watch,
  9. reactive,
  10. defineEmits,
  11. defineExpose
  12. } from 'vue';
  13. const props = defineProps();
  14. const config = reactive({
  15. title: '',
  16. back: {
  17. hide: false, //是否隐藏导航按钮
  18. iconForce: true //是否出现返回按钮
  19. },
  20. bgImage: '../../../../static/标题栏.jpg',
  21. })
  22. watch(
  23. () => props.title,
  24. (val, prevVal) => {
  25. config.title = val
  26. }, {
  27. immediate: true,
  28. deep: true
  29. }
  30. );
  31. watch(
  32. () => props.iconForce,
  33. (val, prevVal) => {
  34. config.back.hide = val
  35. }, {
  36. // immediate: true,
  37. deep: true
  38. }
  39. );
  40. const changeTitle = (e) => {
  41. config.title = e
  42. }
  43. defineExpose({
  44. changeTitle
  45. })
  46. </script>
  47. <style>
  48. </style>