( async function () { Vue.prototype.$roles = window.ctp.roles; Vue.prototype.$accounts = window.ctp.accounts; Vue.component('authority', { props : ['index', 'authority'], methods: { removeRole : function (e) { e.preventDefault(); this.$emit('role-remove', this.index ); } }, template: `
` }); Vue.component('inventory-account',{ props : ['index','account'], methods : { removeAccount : function (e){ e.preventDefault(); this.$emit('account-remove', this.index ); } }, template : ` `, }); let app = new Vue({ el: '#userApp', data: { user : {}, authorities: [], inventoryAccounts: [] }, methods: { addRole: function (e) { e.preventDefault(); this.authorities.push({ 'username' : '', 'authority' : '' }) }, removeRole: function (idx) { this.authorities.splice(idx, 1); }, addAccount: function (e) { e.preventDefault(); this.inventoryAccounts.push({ 'username' : '', 'accountId' : 0 }) }, removeAccount: function (idx) { this.inventoryAccounts.splice(idx, 1); } }, mounted: function () { this.user = window.ctp.user; this.authorities = this.user.authorities; this.inventoryAccounts = this.user.inventoryAccounts; } }) }) (jQuery);