Skip to main content

Template

Template file

Template file is the backbone of the whole widget. It is built on the simple JavaScript function building individual VueInstance which is indivudually created for every user and saved to the database.

It is required to keep syntax excatly like this below for they system to properly work.

(function (internalName) {
    var internalID = internalName;
    return {
        name: internalID,
        component: Vue.component(internalID, {
            props: [],
            data:, 
            mounted() {},
            activated() {},
            deactivated() {},
            methods: {},
            computed: {},
            template: ``
        }),
    }

}("CustomModuleName_DynamicID"));

Language support

To use predefined language strings, depending on the user's default language settings you can simply reference them in the template file like this:

 widgetTitle() {
     return this.$t('Widget name')
}

or directly in the HTML template:

<span> {{$t('Contract loading')}}</span>

Example HTML template:

                <v-flex xs12 md12 d-flex>
                    <material-card
                            style="margin-top:0px"
                            color="primary"
                            :title="widgetTitle">
                        <v-layout class="text-xs-center">
                            <v-flex xs12>
                                <v-rating
                                        v-model="rate"
                                        v-on:input="setMyRate"
                                        :length="5"
                                        :half-increments="false"
                                        hover
                                ></v-rating>
                                <v-card color="success" dark v-if="rate>0"><b>{{$t('Your rate')}}: {{rate}}</b></v-card>
                                <v-card color="error" v-else>{{$t("You haven't rated this idea yet")}}</v-card>
                            </v-flex>
                        </v-layout>
                    </material-card>
                </v-flex>