Skip to content

vue2 项目中存在相同的公用函数要怎样处理? #305

Closed

Description

@yesay

暴露组件的vue2项目 和 引用组件的vue2项目中都包含调用接口使用的公用函数
axios.js
......
export const getRequest = (url, params) => {
let accessTokenRoad = getStore('accessTokenRoad');
return axios({
method: 'get',
url: ${base}${url},
params: params,
headers: {
'accessToken': accessTokenRoad
}
});
};
......

这种情况下,被引用的项目需要将 axios 也暴露出来吗

项目调试时,报如下的错误
2022-08-30_092350

Activity

  1. ckken commented on Aug 30, 2022

    @ckken
    Contributor

    试试 share 加上

  2. yesay commented on Aug 30, 2022

    @yesay
    Author

    是添加这个属性吗?
    2022-08-30_170229

  3. ckken commented on Aug 31, 2022

    @ckken
    Contributor

    是

  4. yesay commented on Aug 31, 2022

    @yesay
    Author

    已经添加了,需要将dependencies下所有的依赖都添加吗?

  5. locked and limited conversation to collaborators on Sep 1, 2022
  6. converted this issue into a discussion #308 on Sep 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions