javascript - 无法读取 Quasar 2 中未定义的属性“原型”
问题描述
我在下面的代码任务的最后一行遇到错误,我该如何解决它。我正在使用 Quasar Framework 版本 2,Axios,它正在使用 Vue js 3,尝试在文件中导入 vue 并访问Vue.prototype实例,但它失败了。如果有任何解决方案,请帮我解决它。
Vue.prototype.$oauth = helper;"
import auth from "../store/auth";
import axios from 'axios';
import { axiosInstance } from "./axios";
import { jsonapiModule } from "jsonapi-vuex";
function isArrayOrString ( variable ) {
if ( typeof variable === typeof [] || typeof variable === typeof "" )
{
return true;
}
return false;
}
export default ( { app, router, store, Vue } ) => {
axios.interceptors.response.use(
response => {
return response;
},
);
/**
* Register i18n
*/
// app.i18n.mergeLocaleMessage('en-us', enUS)
/**
* Register auth store
*/
store.registerModule( "authentication", auth );
store.registerModule(
"jv",
jsonapiModule( axios, { preserveJson: true } )
);
/**
* Set authentication routes
*/
let { routes } = router.options;
let routeData = routes.find( r => r.path === "/auth" );
routeData.children = [
{
path: "/login",
name: "login",
component: () => import( "pages/auth/Login" )
}
];
router.addRoute( [ routeData ] );
// store.dispatch('auth/fetch').catch(() => {
// store.dispatch('auth/logout')
// })
var helper = {};
helper.user = () => {
return store.getters[ "authentication/fetch_access_token" ];
};
helper.user = () => {
return store.getters[ "api/user" ];
};
// console.log( app.prototype );
Vue.prototype.$oauth = helper;
};
解决方案
推荐阅读
- wordpress - 下拉菜单“aria”仅适用于 714px Bootstrap Wordpress 主题
- botframework - 无法在 botframework sdk v3 上发送重试消息
- html - 下拉元素匹配内部元素的宽度
- excel - 如何在excel中匹配区分大小写的两列?
- r - 如何根据列表快速重新编码列值?
- sql - SQL Server:查询以从另一个表中获取表数据(计数)作为 VIEW
- php - phalcon中更新记录的唯一性验证
- node.js - 我可以使用 glob 获得像 D:/ 这样的 Windows 分区的路径吗?
- debugging - 在调试时更改源文件后,要求 Visual Studio 不要通知我
- visual-studio-code - VSCode中文件浏览器的终端