In fact, not all in one JS
Api.js
App.js
Admin.js--vue Backstage
Record the method
Static--admin--hello.js
Import "phoenix_html" Import vue from "Vue"; new Vue ({ el: "#hello-world", data: { message: "Hello World" }});
Brunch-config.coffee
Exports.config = files: javascripts: jointo: ' js/vendor.js ':/(^node_modules\/phoenix|^node_ Modules\/phoenix_html|^node_modules\/vue)/ ' js/app.js ':/(^web\/static\/app)/ ' js/admin.js ':/(^web\/ static\/admin)/ stylesheets: jointo: ' Css/app.css ' templates: jointo: ' Js/app.js ' Conventions: Assets:/^ (web\/static\/assets)/ paths: watched: [ ' web/static ' test/ Static ' ] public : ' Priv/static ' plugins: Babel: ignore: [/web\/static\/vendor/] Modules: autorequire: ' js/app.js ': [' Web/static/app/app '] npm: enabled:true Whitelist: [ ' Phoenix ' phoenix_html ' vue ' ]
App.html.eex
<! DOCTYPE html>Index.html.eex
<div id= "Hello-world" > {{message}}</div>
Phoenix uses vue--separate JS (does not use app.js)