TownSquareXYZ / tonconnect-ui-vue

TonConnect UI Vue is a Vue UI kit for TonConnect SDK.
Apache License 2.0
21 stars 6 forks source link

<TonConnectButton> generates attrs="[object Object]" #15

Open IlyaSemenov opened 4 weeks ago

IlyaSemenov commented 4 weeks ago

<TonConnectButton> in Vue 3 generates invalid HTML attribute:

<div id="ton-connect-button" attrs="[object Object]" style="width: fit-content;">
image

This is probably caused by this:

https://github.com/TownSquareXYZ/tonconnect-ui-vue/blob/ee614c6b09efb3a9ef200887882a88de32a300d6/src/components/TonConnectButton.vue#L27-L35

I guess the second attrs is for Vue 2 compatibility? If so, it should be conditionally added with some kind of isVue2() helper.

kkkkh commented 3 days ago

<TonConnectButton> in Vue 3 generates invalid HTML attribute:

<div id="ton-connect-button" attrs="[object Object]" style="width: fit-content;">
image

This is probably caused by this:

https://github.com/TownSquareXYZ/tonconnect-ui-vue/blob/ee614c6b09efb3a9ef200887882a88de32a300d6/src/components/TonConnectButton.vue#L27-L35

I guess the second attrs is for Vue 2 compatibility? If so, it should be conditionally added with some kind of isVue2() helper.

kkkkh commented 3 days ago

<TonConnectButton> in Vue 3 generates invalid HTML attribute:

<div id="ton-connect-button" attrs="[object Object]" style="width: fit-content;">
image

This is probably caused by this: https://github.com/TownSquareXYZ/tonconnect-ui-vue/blob/ee614c6b09efb3a9ef200887882a88de32a300d6/src/components/TonConnectButton.vue#L27-L35

I guess the second attrs is for Vue 2 compatibility? If so, it should be conditionally added with some kind of isVue2() helper.

  • 1、Your guess is correct, because the inheritattrs attribute of the vue component is false by default. If the attrs attribute is assigned at this time, an attrs="[object Object]" tag will be bound to the div. If inheritattrs is set to true, the attrs="[object Object]" tag will disappear, and the corresponding attributes will be inherited on the div.
  • 2、I don't think this is a bug, it's just a problem of attribute inheritance. Do you want to support attribute inheritance on the div?

I‘m sorry,My answers 1 and 2 are inaccurate. This issue has nothing to do with attribute inheritance, and inheritattrs is true by default. Attrs is the value assignment method of vue2. I will re-process it here.

IlyaSemenov commented 2 days ago

I don't think this is a bug

Emitting attrs="[object Object]" (this is literal HTML) is definitely a bug. This should not be happening.

kkkkh commented 1 day ago

I don't think this is a bug

Emitting attrs="[object Object]" (this is literal HTML) is definitely a bug. This should not be happening.

Ok, We'll handle it quickly @IlyaSemenov