@uni-helper/vite-plugin-uni-platform-modifier
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

vite-plugin-uni-platform-modifier

为属性、指令提供平台修饰符并按需编译

安装

pnpm i -D @uni-helper/vite-plugin-uni-platform-modifier

使用

配置

// vite.config.ts
import { defineConfig } from 'vite'
import Uni from '@dcloudio/vite-plugin-uni'
import UniPlatformModifier from '@uni-helper/vite-plugin-uni-platform-modifier'

export default defineConfig({
  plugins: [Uni(), UniPlatformModifier()],
})

编写代码

<button
  v-text="'hello'"
  v-text.h5.mp-weixin="'h5&mp-weixin'"
  class.h5="h5-class"
  class="default-class"
  @click.h5="handleH5Click"
  @click="handleDefaultClick"
/>
编译到H5
<button
  v-text="'h5&mp-weixin'"
  class="h5-class"
  @click="handleH5Click"
/>
编译到微信小程序
<button
  v-text="'h5&mp-weixin'"
  class="default-class"
  @click="handleDefaultClick"
/>
编译到其他平台
<button
  v-text="'hello'"
  class="default-class"
  @click="handleDefaultClick"
/>

支持的修饰符

['app', 'app-plus', 'h5', 'mp-360', 'mp-alipay', 'mp-baidu', 'mp-jd', 'mp-kuaishou', 'mp-lark', 'mp-qq', 'mp-toutiao', 'mp-weixin', 'quickapp-webview', 'quickapp-webview-huawei', 'quickapp-webview-union']

Readme

Keywords

none

Package Sidebar

Install

npm i @uni-helper/vite-plugin-uni-platform-modifier

Weekly Downloads

30

Version

0.0.2

License

MIT

Unpacked Size

17.8 kB

Total Files

9

Last publish

Collaborators

  • zguolee
  • modyqyw
  • kejunmao