Renaming attributes in a serializer:
export default DS.JSONAPISerializer.extend({
attrs: { results: 'data' }
});
Customizing the key in a list '@identity', '@index', or your own:
| import Ember from 'ember'; | |
| const { | |
| computed, | |
| get | |
| } = Ember; | |
| export default Ember.Component.extend({ | |
| name: computed('name', function() { | |
| console.log('here'); |
| { | |
| "AC": "+247-####", | |
| "AD": "+376-###-###", | |
| "AE": "+971-5#-###-####", | |
| "AE": "+971-#-###-####", | |
| "AF": "+93-##-###-####", | |
| "AG": "+1(268)###-####", | |
| "AI": "+1(264)###-####", | |
| "AL": "+355(###)###-###", | |
| "AM": "+374-##-###-###", |
| import Ember from 'ember'; | |
| export default Ember.Component.extend({ | |
| init() { | |
| this._super(...arguments); | |
| alert('yep'); | |
| } | |
| }); |
| // Make one massive array of all the rules from the stylesheets on the page | |
| const styleSheetRules = Object.keys(document.styleSheets).reduce((rules, i) => { | |
| const styleRules = document.styleSheets[i].cssRules || []; | |
| Object.keys(styleRules).forEach((j) => { | |
| rules.push(styleRules[j]); | |
| }); | |
| return rules; | |
| }, []); | |
| // Function used to lookup the rules from the stylesheet |
Renaming attributes in a serializer:
export default DS.JSONAPISerializer.extend({
attrs: { results: 'data' }
});
Customizing the key in a list '@identity', '@index', or your own:
| import Ember from 'ember'; | |
| const { computed, get, set } = Ember; | |
| /* To replicate issue: | |
| ASDF1 | |
| ASDF1__ | |
| ASDF1___ |
| import Ember from 'ember'; | |
| export default Ember.Controller.extend({ | |
| appName: 'Ember Twiddle' | |
| }); |
| class MyClass { | |
| constructor() { | |
| Object.getOwnPropertyNames(this.constructor.prototype).forEach((m) => { | |
| this[m] = this[m].bind(this) | |
| }); | |
| } | |
| } | |
| } |
VSCode is awesome for use with Vue. You should install the following plugins:
Debugging CSS in Chrome can cause unexpected issues. See the fix here: https://stackoverflow.com/questions/49372717/broke-page-styles-of-vue-js-app-webpack-template-when-live-changing-it-in-chro/51779019#51779019
For VSCode to understand the @ resolver (ex: import X from '@/Y'), you need to configure a jsconfig.json file with the @ path to the src folder.
jsconfig.json
| import { ref } from "vue"; | |
| import useContext from "../utils/useContext"; | |
| const useSampleHook = (userDefinedName) => { | |
| const name = ref(userDefinedName); | |
| return { | |
| name, | |
| refreshData, | |
| }; | |
| }; |