cereschen / vite-jsx

Help use directives such as v-if in the jsx of vite
MIT License
10 stars 1 forks source link

Plug-in ts type error in vite.config.ts #1

Closed anncwb closed 4 years ago

anncwb commented 4 years ago

Plug-in ts type error in vite.config.ts

anncwb commented 4 years ago

Now it can only be used like this

plugins: [
    (createJsxPlugin as any)(),
  ],
anncwb commented 4 years ago

And this needs to be changed to optional interface IntrinsicAttributes { ['v-if']?: unknown; ['v-else-if']?: unknown; ['v-else']?: unknown; ['v-show']?: unknown; ['v-html']?: unknown; ['v-text']?: unknown; ['v-model']?: unknown; } }

anncwb commented 4 years ago
interface IntrinsicAttributes {
['v-if']?: unknown;
['v-else-if']?: unknown;
['v-else']?: unknown;
['v-show']?: unknown;
['v-html']?: unknown;
['v-text']?: unknown;
['v-model']?: unknown;
}
}
cereschen commented 4 years ago

Thanks for your issue,already fixed and updated

anncwb commented 4 years ago

Big problem, your plug-in may cause the component to fail responsively.

anncwb commented 4 years ago
in .tsx file

setup(){
 return () => {
      const bar = unref(getBarRef);
      const { size, move } = props;
      return (
        <div
          class={['scrollbar__bar', 'is-' + bar.key]}
          onMousedown={clickTrackHandler}
          ref={elRef}
        >
          <div
            ref={thumbRef}
            class="scrollbar__thumb"
            onMousedown={clickThumbHandler}
            style={renderThumbStyle({ size, move, bar })}
          />
        </div>
      );
    };

Will cause the style dynamic calculation to fail

anncwb commented 4 years ago
 style={renderThumbStyle({ size, move, bar })}  Will not be responsive, remove jsx-plugin to restore
anncwb commented 4 years ago

Other attributes should be the same. I dare not use it now

cereschen commented 4 years ago

I'm sorry that I didn't have a careful test before, you can update and try again

anncwb commented 4 years ago

It’s great, but I checked this problem for a long time before I found out

anncwb commented 4 years ago

class={xxx}. Will not be responsive, remove jsx-plugin to restore

cereschen commented 4 years ago

class={xxx}. Will not be responsive, remove jsx-plugin to restore

can you show your code? There is nothing wrong with my test Do you use a functional component?