monoplasty / vue3-slide-verify

vue3 typescript slide verify
MIT License
60 stars 5 forks source link

css 样式缺失 #7

Closed wuchaoxin closed 1 year ago

wuchaoxin commented 1 year ago

问题:按照 README 给出提示进行运行 DEMO,发现样式总是缺失。手动引入了下 dist 下的 style 文件,依旧不生效。

原因:格式化 css 文件后发现产出 css 带入了 hash 值。

image

期望:样式能够正常显示

monoplasty commented 1 year ago

我本地新建项目使用没有 vue3-slide-verify@1.1.4 样式没有问题,你能提供一下你使用地方的代码片段吗?这样方便排查问题所在。谢谢!

wuchaoxin commented 1 year ago

我本地新建项目使用没有 vue3-slide-verify@1.1.4 样式没有问题,你能提供一下你使用地方的代码片段吗?这样方便排查问题所在。谢谢!

你可以在一个空的项目进行下载vue3-slide-verify,复现流程:

  1. 空文件夹里执行 npm init -y
  2. 执行 npm i vue3-slide-verify
  3. 打开 node_modules 下的 vue3-slide-verify 里的 dist 下的 style
monoplasty commented 1 year ago

样式上加了 hash值时没有问题的。 因为写插件的时候style 上加了 scoped ,所以打包出来的样式上会有 hash值。这样可以避免类冲突。但是不影响使用的。

依然不知道你的具体问题是什么。

wuchaoxin commented 1 year ago

vue3-slide-verify

可以参见下这个链接:https://codesandbox.io/s/blissful-pare-fyj8eo?file=/src/App.vue

monoplasty commented 1 year ago

加上这个就好了

<script>
import SlideVerify from "vue3-slide-verify";
import { defineComponent } from "vue";

import "vue3-slide-verify/dist/style.css";

export default defineComponent({
  components: { SlideVerify },
});
</script>
wuchaoxin commented 1 year ago

加上这个就好了

<script>
import SlideVerify from "vue3-slide-verify";
import { defineComponent } from "vue";

import "vue3-slide-verify/dist/style.css";

export default defineComponent({
  components: { SlideVerify },
});
</script>

欧,看来是的,在这个 DEMO 这样解决了。在我自己的项目中,这样也不行,似乎是什么影响了 hash 值,我手动移除了 hash 值可以使用。