entry-runtime-with-compiler.js内const mount = Vue.prototype.$mountVue.prototype.$mount = function ( el?: string | Element, hydrating?: boolean): Component { el = el && query(el) /* istanbul ignore if */ if (el === document.body || el === document.documentElement) { process.env.NODE_ENV !== 'production' && warn( `Do not mount Vue to <html> or <body> - mount to normal elements instead.` ) return this }//太长了贴一部分/runtime/index.jsVue.prototype.$mount = function ( el?: string | Element, hydrating?: boolean): Component { el = el && inBrowser ? query(el) : undefined return mountComponent(this, el, hydrating)}然后我自己新建几个js试了下为什么不行呢test.jsfunction va(){}export {va}test1.jsimport {va} from './test.js'va.prototype.hei = function(){ alert(1) console.log(1)}test2.jsimport {va} from './test.js'const ob = va.prototype.heiva.prototype.hei = function(){ alert(2) console.log(2)}test3.jsimport {va} from './test.js'var a = new va();a.hei()最后只alert2,打印了2ps:我为了保持相似所以建了好几个..但是为什么不行呢
添加回答
举报
0/150
提交
取消