Comments (3)
你一开始是怎么做的呢,是封装成一个svgIcon组件使用?可否贴一下代码。另外,直接把 svg 代码嵌入html,确实是有问题,需要这样写才生效:
<template>
<div v-html="svgCode"></div>
</template>
<script setup>
import { ref } from 'vue'
const svgCode = ref(`<svg t="1692163553760" class="icon" viewBox="0 0 1025 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4254" width="32" height="32"><path d="M16.943988 16.886615C3.127666 31.214652 0.569088 37.35524 0.569088 58.33558v25.074065l213.385411 214.408842 213.385411 214.408843-199.569089 200.59252c-110.018857 110.018857-206.221392 208.268255-213.385411 217.479136-20.468625 25.585781-18.933478 53.218424 3.582009 75.733911 22.515487 22.515487 50.14813 24.050634 75.733911 3.58201 9.210881-7.164019 107.460279-103.366554 217.479136-213.385412L512.284702 596.14869l201.104236 200.080805c110.018857 110.018857 208.268255 206.221392 217.479136 213.385412 25.585781 20.468625 53.218424 18.933478 75.733911-3.58201 22.515487-22.515487 24.050634-50.14813 3.58201-75.733911-7.164019-9.210881-103.366554-107.460279-213.385412-217.990851L596.717778 511.715614l200.080805-201.104236c110.018857-110.018857 206.221392-208.268255 213.385412-217.479136 22.003771-27.120928 16.886615-63.964452-11.76946-86.479939-4.093725-3.582009-18.933478-6.652303-32.749799-6.652303h-25.585781l-213.897126 213.385411L512.284702 426.770822 298.387575 213.385411 84.490449 0h-25.585781C36.389181 0 31.272025 2.046862 16.943988 16.886615z" p-id="4255"></path></svg>`)
</script>
from vite-plugin-crx-mv3.
这两种写法都不行:
<template>
<div class="flex h-20 w-full items-center justify-between bg-white px-10">
<img src="@/assets/chat.png" alt="logo" class="h-6" />
<span class="font-bold text-neutral-700">Cheat GPT</span>
<button
type="button"
class="m-1 h-6 w-6 rounded-full fill-neutral-500 shadow-sm ring-inset ring-gray-300 hover:bg-gray-50 hover:ring-1">
<XMarkIcon class="m-1 h-6 w-6" />
<svg
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 0 32 32"
class=""
height="32"
width="32">
<path
d="M24 9.4L22.6 8L16 14.6L9.4 8L8 9.4l6.6 6.6L8 22.6L9.4 24l6.6-6.6l6.6 6.6l1.4-1.4l-6.6-6.6L24 9.4z"
fill="currentColor"></path>
</svg>
</button>
</div>
</template>
<script setup>
import { XMarkIcon } from '@heroicons/vue/24/solid';
</script>
from vite-plugin-crx-mv3.
目前在content_scripts中,是会存在这样的问题,暂时还没找到解决方案。不过,如果在popup中使用,是没有问题的。
from vite-plugin-crx-mv3.
Related Issues (20)
- How can we use `import` in `background.ts` HOT 3
- manifest->background 设置type:"module",打包后自动被去除 HOT 2
- manfest.json的 action设置为{} 后 Cannot use 'in' operator to search for 'width' in undefined HOT 2
- production: build never ends HOT 1
- 关于content样式隔离 HOT 10
- window.localtion.reload是否可以添加配置控制 HOT 5
- unsafe-eval HOT 1
- newtab.html 不能用vue构建 HOT 8
- 注入js文件 HOT 11
- 插件无法运行 HOT 4
- content_scripts "world": "MAIN" 报错 HOT 7
- request support i18n HOT 1
- import 无法直接引入包 HOT 7
- Manifest.web_accessible_resources 似乎没有处理 content script 所动态引入的 injected.js HOT 5
- Failed to load config (The requested module 'acorn' does not provide an export named 'default') HOT 1
- 打包时生成manifest.json中的default_popup的地址也许可以优化 HOT 1
- Support new versions of vite(typescript) with acorn library exporting HOT 1
- Sourcemap is likely to be incorrect: a plugin (vite-plugin-crx-mv3) was used to transform files, but didn't generate a sourcemap for the transformation. Consult the plugin documentation for help HOT 6
- content-scripts的热部署貌似会有问题,需要重新到插件中心,刷新才能更新最新内容
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vite-plugin-crx-mv3.