@uni-helper/vite-plugin-uni-platform-modifier
v0.0.2
Published
为属性、指令提供平台修饰符并按需编译
Downloads
564
Readme
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"
/>
<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']