vue example, be used together and extend methods-- instance attributes vue jQuery.js

Need to introduce jQuery.js CDN before use

Then re-configured using an internal mount jQuery methods can be used directly;

In the external configuration may be an internal constructor method call, to the constructor needs naming

Then external constructor, using the constructor external to internal method name calling

Code examples are as follows:

<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>example methods</title>
<script src="../assets/js/vue.js"></script>
<script src="../assets/js/jquery-3.1.0.min.js"></script>
</head>

<body>
<h1>example methods</h1>
<hr>
<div id="app">
{{message}}
</div>

<script>
was app = new Vue ({
the '#app'
data: {
message: 'hellow word'
},
methods: {
add() {
the console.log ( 'add method calls inside the constructor')
}
},
mounted() {
$ ( '# App'). Html ( 'I am a jquery')
},
})
app.add()
</script>
</body>

</html>

 

Guess you like

Origin www.cnblogs.com/sunyang-001/p/11105071.html