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` ;
} ,
} ;版權所有©2018代碼總部(PTY)Ltd。此源代碼是根據許可證文件中的MIT許可證的許可。
由Craig Pretorius製成的