0.1.7 • Published 4 years ago

dsconfig v0.1.7

Weekly downloads
-
License
ISO
Repository
-
Last release
4 years ago

Welcome to the dsconfig component

dsconfig is a dynamic configuration acquisition component that uses ajax to retrieve and return remote configurations. Users can encapsulate the configuration into Vue's global variables or nodejs-based server application global configuration. Supported browsers: IE9 +, Firefox, Chrome, Safari and Opera

Component Installation

Excuting Command:npm install dsconfig

Example

main.js

import Vue from 'vue';
import App from './App.vue';
import dsconfig from 'dsconfig';
async function initVue() {
    try{
        let configs = await dsconfig({
            url: "https://easy-mock.com/mock/5e69a2ecc945691e949c90ea/example/config"    
        });
        Vue.prototype.$config = configs;
        new Vue({
            render: h => h(App),
        }).$mount('#app');
    } catch (e) {
        // failed callback
        console.log(e);
    }
}

App.vue

<template>
  <div id="app"></div>
</template>
<script>
export default {
    name: 'App',
    mounted() {
        // The config from server can be used here.
        console.log(this.$config);
    }
};
</script>

Configuration Instructions

Configure KEYIs it requiredDescription
urlYRemote configuration address, default is null.
asyncNWhether to load true / false asynchronously. The default true indicates asynchronous.
methodNRequest method POST / GET, default POST.
dataNPOST request parameters, GET request parameters are directly behind the url.
0.1.7

4 years ago

0.1.6

4 years ago

0.1.4

4 years ago

0.1.5

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago