FranckFreiburger / http-vue-loader

load .vue files from your html/js
MIT License
1.49k stars 275 forks source link

Component name & url without .vue extension #111

Closed pal-software closed 4 years ago

pal-software commented 4 years ago

Hello.

Problem

Now when I try to use this code

httpVueLoader('?r=db_user/list' )

then script request url: ?r=db_user/list/index.vue

(url modifyed by function parseComponentURL(url) used every time by httpVueLoader() )

So...

Maybe to change code from

    function httpVueLoader(url, name) {

        var comp = parseComponentURL(url);
        return httpVueLoader.load(comp.url, name);
    }

to something such:

function httpVueLoader(url, name)
{
   var comp = ( typeof name !== 'string' )? parseComponentURL(url) : { name: name, url: url };

   return httpVueLoader.load(comp.url, comp.name);
}

(i changed it for myself)

Then we can to write, for example:

httpVueLoader( 'https://some.site/component_maker.php?r=user/list', 'myUserListComponent' );

P.S.: now at the source httpVueLoader has 2 parameters ('url' & 'name'), but second parameter 'name' not used.

P.P.S.: and then maybe to change documentation ... write about second parameter 'name' of httVueLoader.

my English is very bad. sorry. :)