vite-vue-template-src
v1.0.1
Published
Let the template tag of vuejs support the src attribute, which is used to load external template files, such as <template src="./my-template.html"></template>
Maintainers
Readme
vite-vue-template-src
使vuejs的template标签支持src属性,用来加载外部的模板文件,例如<template src="./my-template.html"></template>
Let the template tag of vuejs support the src attribute, which is used to load external template files, such as <template src="./my-template.html"></template>
安装 (install)
npm install vite-vue-template-src -D插件基于vite 5开发,,其他版本自行测试。
使用 (use)
- 配置 (configuration)
// vite.config.js
import VueTemplateSrc from 'vite-vue-template-src'
import { defineConfig } from 'vite'
export default defineConfig({
plugins: [
VueTemplateSrc()
]
})- 在vuejs文件中使用 (in vuejs file)
// test.vue
<template src="./test.html"></template>
<script setup>
// import MyComponent from './my-component.vue'
</script>
// test.html
<!--<MyComponent></MyComponent>-->
提示 (tip)
src属性目前只支持静态文件路径,暂不支持动态绑定!
The src attribute currently only supports static file paths and does not support dynamic binding yet!
