0.1.13 • Published 2 years ago

unplugin-vue-setup-attributes v0.1.13

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

unplugin-vue-setup-attributes

English | 简体中文

Extend vue script setup syntax,make it support the name and inheritAttrs attribute.

Features

  • ✨ Extend vue script setup syntax,make it support the name and inheritAttrs attribute.
  • 💚 Supports both Vue 2.7 and Vue 3 out-of-the-box.
  • ⚡️ Supports Vite, Webpack, Vue CLI, Rollup, esbuild and more, powered by unplugin.

Installation

npm

npm i unplugin-vue-setup-attributes -D

Usage

Config

Config plugin in build tool configuration file,such as vite.config.ts,vue.config.js and webpack.config.js

Vite

// vite.config.ts
import { Plugin, defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueSetupAttributes from 'unplugin-vue-setup-attributes'

export default defineConfig({
  plugins: [vue(), vueSetupAttributes()],
})

Webpack

// vue.config.js

module.exports = {
  configureWebpack: {
    plugins: [
      require('unplugin-vue-setup-attributes')()
    ]
  },
}
// webpack.config.js

module.exports = {
  plugins: [
    require('unplugin-vue-setup-attributes')()
  ]
}

SFC

<script setup lang="ts" name="Home" inheritAttrs="false">
  import { ref } from 'vue'
  const foo = ref("foo")
</script>
<script lang="ts">
import { defineComponent } from 'vue'
export default defineComponent({
  name: 'Home',
  inheritAttrs: false,
})
</script>

<script setup lang="ts">
  import { ref } from 'vue'
  const foo = ref("foo")
</script>

License

MIT License © 2022 zedyuan999

0.1.13

2 years ago

0.1.12

2 years ago

0.1.11

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.1

2 years ago