vue 定义mixin

main全局引入

import mixin from './mixins/mixin'

Vue.mixin(mixin)

import { stages } from '../config'

export default {
  methods: {
    jumpToStage (stage, param) {
      param ? this.$router.push({name: stages[stage + 2], params: param}) : this.$router.push({name: stages[stage + 2]})
    },
    downloadFile (target) {
      let iframe = document.getElementById('iframe_used_to_downloadFile')
      if (!iframe) {
        iframe = document.createElement('iframe')
        iframe.id = 'iframe_used_to_downloadFile'
        iframe.style.display = 'none'
        document.body.appendChild(iframe)
      }
      iframe.src = target
    }
  }
}

猜你喜欢

转载自blog.csdn.net/Running_FE/article/details/80408781
今日推荐