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

不能对vue进行alias设置。 #5232

Open
vijftienster opened this issue Nov 25, 2024 · 2 comments
Open

不能对vue进行alias设置。 #5232

vijftienster opened this issue Nov 25, 2024 · 2 comments
Labels
等待用户反馈 waiting feedback

Comments

@vijftienster
Copy link

vijftienster commented Nov 25, 2024

          不能对vue进行alias设置。

uniapp插件内部有对 vue 做alias设置,以便指向uniapp内部定制化的vue 库。

Originally posted by @bfc846958672 in #5169 (comment)

在vue项目中如果要实现组件的运行时编译,需要对 vue 做alias设置指定vue/dist/vue.esm-bundler.js
如果uni-app不支持这样设置,有其他解决方案么?

@Otto-J
Copy link
Member

Otto-J commented Dec 2, 2024

uniapp 里的 uni 是定制的,不能修改,你具体需要做什么?

@Otto-J Otto-J added the 等待用户反馈 waiting feedback label Dec 2, 2024
@vijftienster
Copy link
Author

uniapp 里的 uni 是定制的,不能修改,你具体需要做什么?

需求比较简单,可以支持运行时编译组件,下面是个简单的例子:

<template>
  <view>
    <my-widget></my-widget>
  </view>
</template>

<script setup>
import { shallowRef } from 'vue'
const MyWidget = shallowRef({
  name: 'MyWidget',
  props: {},
  template: `<button @click='onClick'>这是一个按钮</button>`,
  methods: {
    onClick() {
      alert('点击了按钮')
    },
  },
})
</script>

<style></style>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
等待用户反馈 waiting feedback
Projects
None yet
Development

No branches or pull requests

2 participants