index.js 650 B

1234567891011121314151617181920212223242526272829303132
  1. import Validate from './validate.vue'
  2. import i18n from '@/util/lang/lang'
  3. Validate.install = function (Vue, store) {
  4. const Constructor = Vue.extend(Validate)
  5. let instance
  6. Vue.prototype.$showValidate = (resultData) => {
  7. if (instance) {
  8. document.body.removeChild(instance.$el)
  9. instance = null
  10. }
  11. instance = new Constructor({
  12. el: document.createElement('div'),
  13. computed: {
  14. $store () { return store }
  15. },
  16. data () {
  17. return {
  18. visible: true,
  19. resultData
  20. }
  21. },
  22. i18n
  23. })
  24. document.body.appendChild(instance.$el)
  25. }
  26. }
  27. export default Validate