Skip to content

Conversation

Blackgan3
Copy link
Collaborator

功能

支持原生组件跨平台输出H5

待补充

  • 小程序原生组件中绑定事件使用动态绑定
  • 小程序import + template语法支持

})
},
methods: {
setData (data, callback) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

通过Vue.prototype来挂载

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

移到VuePlugin.js当中

})
}
}
if (queryObj.isNative && nativeLoaderIndex !== loaders.length - 1) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需要考虑.ts的情况

if (mode === 'web') {
resource = `${resource}?isNative=true`
} else {
resource = `!!${nativeLoaderPath}!${resource}?isNative=true`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

统一在afterResolve中插入nativeLoader吧,这里统一加isNative Query就可以

componentPlaceholder = componentPlaceholder.concat(Object.values(json.componentPlaceholder))
}

if (mode === 'web') {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这块不会是copy的吧,抽一个通用逻辑呗

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vueContentCache的逻辑补齐

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mainScript逻辑补齐

}, callback)
},
(callback) => {
if (mode === 'web') {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

只有template和json需要预读,且文件的支持类型需要保持一致

// 兼容处理处理ts-loader中watch-run/updateFile逻辑,直接跳过当前loader及后续的loader返回内容
const pathExtname = path.extname(this.resourcePath)
if (!['.vue', '.mpx'].includes(pathExtname)) {
const { queryObj } = parseRequest(this.resource)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这块不可能经过selector的

return
}
Object.keys(data).forEach(key => {
this[key] = data[key]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需要支持路径设置

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需要调用forceUpdate

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需要考虑key不在原有data中的情况

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

Successfully merging this pull request may close these issues.

2 participants