mixin.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // import {Toast} from "vant";
  2. export default {
  3. methods: {
  4. goTopic(id) {
  5. this.$router.push({
  6. name: 'topic-detail',
  7. params: {
  8. id
  9. }
  10. })
  11. },
  12. /**
  13. * @description '路由跳转'
  14. * @param {String} name 跳转的路由name
  15. * @param {Object} params 跳转参数
  16. * @param {String} type 跳转方式,可选值:push|replace 默认push
  17. *
  18. */
  19. goNavigator(name, params, type = 'push') {
  20. if(name){
  21. if (type === 'push') {
  22. this.$router.push({
  23. name,
  24. params
  25. })
  26. } else {
  27. this.$router.replace({
  28. name,
  29. params
  30. })
  31. }
  32. }else{
  33. alert('建设中,敬请期待...')
  34. }
  35. }
  36. }
  37. }