Where should i put the javascript in a route page?

i write the javascript inside the page, but it does not work,how can i do it?thanks

Need more code examples, we have no idea where do you put it and why it doesn’t work

here is the code example:

routes: [ {
name : ‘view’,
path : ‘/leave/:leaveId’,
url : ‘wx/view?leaveId={{leaveId}}’, //go to view.page
beforeEnter : function(routeTo, routeFrom, resolve, reject) {
} ]
view.page content:

<div class="page">
    //here is page content, i need bind events for some elements, how can i do it in <script >
<script type="text/javascript">
alert('viewPage'); // this script does not work
</script >