вторник, 31 декабря 2019 г.

[Typescript] [Vue] how to declare child vue component

This post describes an situation, when you want to put component to your parent vue component. In this example parent component is App, and child component is Canvas.

Firstly, install a vue-class-component npm package.
Then for your Typescript class use annotation like this:

import Vue from 'vue';
import Component from 'vue-class-component';
import {Canvas} from "./Canvas";

@Component({
    template: `<div><Canvas-component @element-added="addElement"></Canvas-component></div>`,
    components: {
        'Canvas-component': Canvas
    }
})
export default class App extends Vue
...
Like this you can declare also props field like in vanilla js Vue component.

вторник, 17 декабря 2019 г.

[Android] admob invalid application id fix

If you tried everything from https://developers.google.com/admob/android/quick-start#update_your_androidmanifestxml and still doesn't work, get a test Ads from here , for example Banner ad format, paste it into your AndroidManifest.xml and change its meta-data value slash symbol (/) to tilda (~).

воскресенье, 8 декабря 2019 г.

"vue.use is not a function" fix

You should call vue.use() before vue object initialization (before calling new Vue({})), not after, and call it like static method, not instance method. For example:

import Vue from 'vue';
import App from "./App";
import * as VueWindow from '@hscmap/vue-window'

Vue.use(VueWindow);
let vue = new Vue({
    el: '#app',
    template: '<App></App>',
    render: h => h(App)
})
export {vue};

пятница, 6 декабря 2019 г.

[Typescript] "cannot find module 'vue'" error fix

When you write import Vue from 'vue'; and get error cannot find module 'vue' , fix it with adding this in tsconfig.json:

{
  "compilerOptions": {
    "moduleResolution": "node",
    ...
   }
   ...
}

воскресенье, 1 декабря 2019 г.

Symfony server - all routes fail with 404 fix

If you know that your project has working routes, but at requesting them with browser occasionally Symfony new server responds with 404 with any route, it can be your started Symfony local Web server (symfony command from CLI) from wrong directory, for example, in the parent folder after git cloning. In other words, check the current directory before running symfony serve command.

sylius.resource_controller.flash_helper has a dependency on a non-existent parameter "locale" - fix

if you have the such error:

The service "sylius.resource_controller.flash_helper" has a dependency on a non-existent parameter "locale". Did you mean one of these: "kernel.default_locale", "stof_doctrine_extensions.default_locale"?

It means you do not have an locale service parameter. To fix this, add this to the beginning of your project config/services.yaml file:

# This file is the entry point to configure your own services.
# Files in the packages/ subdirectory configure your dependencies.

# Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
parameters:
    locale: en