Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Taro做快应用,从@tarojs/components引入web-view后无法跳转src中的url #3451

Closed
Masterzyy opened this issue Jun 17, 2019 · 9 comments

Comments

@Masterzyy
Copy link

Masterzyy commented Jun 17, 2019

问题描述:
Taro做快应用,从@tarojs/components引入web-view后无法跳转src中的url
复现步骤 [复现问题的步骤]
①:import { WebView } from '@tarojs/components/';(此处components后添加‘/’,是为了避免从@tarojs/components-qa中引用)从@tarojs/components中引入web-view,指定src中的url
②:无法跳转到web-view中src的地址。
image

报错信息
image

系统信息
Taro 版本 [v1.3.0]
Node.js 版本 [v10.16.0]
报错平台 [快应用]
补充信息:
从@tarojs/components中引入web-view时会默认从@tarojs/components-qa中引用web-view
报错信息如图:
image

@taro-bot
Copy link

taro-bot bot commented Jun 17, 2019

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

@Masterzyy
Copy link
Author

没有人处理问题吗?

@Garfield550
Copy link
Collaborator

@tarojs/components-qa 里包含了只有快应用支持的组件,请不要改变 Taro 引入组件的行为。

另外注意到你的 Taro 版本是 1.3.0,最新版 1.3.5 修复了很多快应用的问题,建议更新一下。

@Masterzyy
Copy link
Author

@tarojs/components-qa 里包含了只有快应用支持的组件,请不要改变 Taro 引入组件的行为。

另外注意到你的 Taro 版本是 1.3.0,最新版 1.3.5 修复了很多快应用的问题,建议更新一下。

我是要从@tarojs/components 引用WebView,实际上写为import { WebView } from '@tarojs/components 时 为什么会从@tarojs/components-qa中引,而@tarojs/components-qa中是没有webview的

@Garfield550
Copy link
Collaborator

@tarojs/components-qa 里包含了只有快应用支持的组件,请不要改变 Taro 引入组件的行为。
另外注意到你的 Taro 版本是 1.3.0,最新版 1.3.5 修复了很多快应用的问题,建议更新一下。

我是要从@tarojs/components 引用WebView,实际上写为import { WebView } from '@tarojs/components 时 为什么会从@tarojs/components-qa中引,而@tarojs/components-qa中是没有webview的

有的,19 小时以前,抱歉应该是 1.3.6 新增的。

image

<template>
<web
class="{{className}}"
style="{{style}}"
onclick="handleClick"
trustedurl="{{trustedurl}}"
allowthirdpartycookies="{{allowthirdpartycookies}}"
>
</web>
</template>
<script>
export default {
props: {
classname: {
type: String,
required: false,
},
src: {
type: String,
required: false,
default: ''
},
style: {
type: Object,
required: false,
default: {}
},
trustedurl: {
type: Array,
required: false,
default: {}
},
allowthirdpartycookies: {
type: Boolean,
required: false,
default: {}
}
},
data: () => ({
}),
onInit () {
},
handleClick (e) {
this.$emit('click', e)
}
}
</script>
<style>
</style>

@Garfield550
Copy link
Collaborator

@tarojs/components 的 WebView 应该是没有快应用适配,还是让 CLI 自己从 @tarojs/components-qa 里引入吧。

@YouthBaby
Copy link

@Garfield550
Error: ENOENT: no such file or directory, scandir 'E:\project\miniapp\node_modules@tarojs\components-qa\src\components\web-view'

components-qa里是webview,但是编译@tarojs\components里的WebView会解析为components-qa\web-view,找不到文件

@tarojs/cli: 1.3.6
node: 10.16.0
windows 10 1903

@Garfield550
Copy link
Collaborator

@Garfield550
Error: ENOENT: no such file or directory, scandir 'E:\project\miniapp\node_modules@tarojs\components-qa\src\components\web-view'

components-qa里是webview,但是编译@tarojs\components里的WebView会解析为components-qa\web-view,找不到文件

@tarojs/cli: 1.3.6
node: 10.16.0
windows 10 1903

建议提一个新的 Issue,这个问题和这个 Issue 标题与描述不一致。

@jinjinjin0731
Copy link
Contributor

@Masterzyy 问题修复了。 你就按照 @tarojs/components 这样写。 这个是多端标准组件库的一个入口路径。 在编译成各端的时候, 会找到对应平台的组件。 快应用理所应当是在 @tarojs/components-qa 这里引入。 缺少的 webview 已经补齐。下个版本即可。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants