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制成的