vue aspnet auth
v1.5.4
AspNet-AuthのVueプラグインラッパー。
NPMから
npm install vue-aspnet-auth --saveプラグインをインポートして初期化します。
import { AspnetAuth } from 'vue-aspnet-auth' ;
Vue . use ( AspnetAuth , {
url : 'http://localhost:46993' ,
} ) ;基本的なログイン例:
export default {
name : 'login' ,
data ( ) {
return {
username : '' ,
password : '' ,
} ;
} ,
methods : {
login ( ) {
this . $auth . login ( this . username , this . password , ( data ) => {
if ( data . result ) {
this . $store . commit ( 'auth' , this . $auth . authentication ) ;
this . $root . $emit ( 'app.loggedin' ) ;
} else {
this . error = data . message ;
}
} ) ;
} ,
} ,
created ( ) {
// initialize url
this . $auth . url = `http://localhost:1234` ;
} ,
} ;Copyright©2018 Code HQ(Pty)Ltd。このソースコードは、ライセンスファイルにあるMITライセンスに基づいてライセンスされています。
Craig Pretoriusによって♥で作られました