<!DOCTYPE html>
<html>
<head>
<div id='app'>
</div>
</head>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.0.5/vue.js"></script>
<script type="module" src="./main.js"></script>
</body>
</html>
main.js
import { default as myMixin, x } from './mixins/mixfile.js';
console.log(x());
const app = new Vue({
el: "#app",
mixins: [myMixin],
data: {
loading: false,
},
created: function () {
console.log(this.$data);
}
});
mixins/maxfile.js
var myMixin = {
data() {
return {
someval: 'asdfasdf'
}
},
created: function () {
this.hello()
},
methods: {
hello: function () {
console.log('hello from mixin!')
}
}
}
function x() {
return 'ad';
}
export { myMixin as default, x }
No comments:
Post a Comment