Skip to content

Commit

Permalink
feat: preview img
Browse files Browse the repository at this point in the history
  • Loading branch information
markthree committed Feb 26, 2023
1 parent 77928de commit eb51add
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 9 deletions.
35 changes: 35 additions & 0 deletions components/content/prose-img.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<script setup lang="ts">
import { withBase } from 'ufo'
import { Image as AImage } from "@arco-design/web-vue";
import "@arco-design/web-vue/es/image/style/css.js"
const props = defineProps({
src: {
type: String,
default: ''
},
alt: {
type: String,
default: ''
},
width: {
type: [String, Number],
default: undefined
},
height: {
type: [String, Number],
default: undefined
}
})
const refinedSrc = computed(() => {
if (props.src?.startsWith('/') && !props.src.startsWith('//')) {
return withBase(props.src, useRuntimeConfig().app.baseURL)
}
return props.src
})
</script>

<template>
<AImage class="cursor-pointer" v-bind="$attrs" :src="refinedSrc" :alt="alt" :width="width" :height="height">
</AImage>
</template>
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"release": "bumpp --commit --push --tag"
},
"devDependencies": {
"@arco-design/web-vue": "^2.43.2",
"@nuxt-themes/docus": "^1.8.3",
"@nuxt/devtools": "^0.2.3",
"@nuxt/image-edge": "1.0.0-27954023.4cee565",
Expand All @@ -35,7 +36,8 @@
"nuxt3-intelligence": "^0.1.1",
"serve": "^14.2.0",
"sitemap": "^7.1.1",
"tsx": "^3.12.3"
"tsx": "^3.12.3",
"ufo": "^1.1.0"
},
"pnpm": {
"peerDependencyRules": {
Expand Down
74 changes: 66 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit eb51add

Please sign in to comment.