Coder Social home page Coder Social logo

Comments (3)

b2nil avatar b2nil commented on June 16, 2024

OpenData 只有 AtAvatar 用到。这个报错影响程序正常运行么?

from taro-ui-vue3.

zjy2931 avatar zjy2931 commented on June 16, 2024

不影响运行也不应当这样报错 吧

from taro-ui-vue3.

b2nil avatar b2nil commented on June 16, 2024

@zjy2931 @yyq914828jzg

其他没有 OpenData 组件的小程序平台使用时会报错,是因为 AtAvatar@tarojs/components 中明确引用了 OpenData 组件:

import { Image, OpenData, Text, View } from '@tarojs/components'

两个办法:

  1. 如果不使用 AtAvatar 组件,不要引用就行了。请按需引用其他组件。
// 这样会引用全部组件,包括 AtAvatar。
import { createUI } from 'taro-ui-vue3'
const tuv3 = createUI()
...
App.use(tuv3)
  1. 如果要使用 AtAvatar 组件,请自行修改。
    • 不要从 @tarojs/components 引用 OpenData
    • 使用 vueresolveComponent 函数来解析 OpenData 组件
const children = isWEAPP && props.openData && props.openData.type === 'userAvatarUrl'
			? h(resolveComponent('open-data'), { type: props.openData.type })
			: props.image
				? h(Image, { class: 'at-avatar__img', src: props.image })
				: h(Text, { class: 'at-avatar__text' }, { default: () => letter.value })

from taro-ui-vue3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.