The problem with the Vue click incident?

I see that someone on github also mentioned a similar issue on this question, but he didn"t seem to give a specific reason. https://github.com/vuejs/vue/...

specific scenario
I defined a method such as

in a header file.

var ms = {

open:function(url){
    //
}

}

on the specific page, I introduce this file into the header

this is the business code

< div id="app" >

<button @click="ms.open("./home/)">1</button>
<button onclick="ms.open("./home/)">2</button>

< / div >
< script >

var app = new Vue({
    el:-sharpapp,
    data:{
    }
})

< / script >

here comes the problem. Whether I click button 1 or button 2, it shows that ms is not defined? Excuse me, bosses, what is the reason for this? Is there a good solution to such a scenario?

May.19,2022

conclusion: for some unknown reason, vue.min.js did not set _ renderProxy to hasProxy , causing the with statement to execute its original semantics correctly.

hit the breakpoint and find out the reason:

is essentially a problem of with .
Let's take a look at the place where the rendering proxy is set in vue.js:

 

template of vue. This is automatically added to the front to point to the vm instance.

for example: @ = "fn". That must be the fn property of this component.
then, what you write on the outside cannot be monitored, so that's why you report this problem.

Menu