save
This commit is contained in:
parent
57df3c90bf
commit
8ea667e4f9
|
@ -36,6 +36,7 @@
|
|||
"localforage": "^1.10.0",
|
||||
"lodash": "^4.17.21",
|
||||
"lunar-typescript": "^1.7.5",
|
||||
"milkdown-plugin-placeholder": "^0.2.1",
|
||||
"oh-vue-icons": "^1.0.0-rc3",
|
||||
"pinia": "^2.1.7",
|
||||
"pinia-plugin-persistedstate": "^3.2.3",
|
||||
|
|
|
@ -30,7 +30,7 @@ export default defineComponent({
|
|||
'w-full rounded-lg overflow-hidden flex justify-center items-center p-2 hover:scale-110 transition-all cursor-pointer ' +
|
||||
(searchConfig.current.name === item.name
|
||||
? 'bg-white'
|
||||
: 'bg-white/40 hover:bg-white/60')
|
||||
: 'bg-white ')
|
||||
}
|
||||
onClick={() => {
|
||||
searchConfig.current = { ...item }
|
||||
|
@ -45,9 +45,10 @@ export default defineComponent({
|
|||
}}
|
||||
>
|
||||
<div
|
||||
class="w-6 h-6 bg-center bg-no-repeat bg-contain"
|
||||
class="w-[28px] h-[28px] bg-center bg-no-repeat bg-contain rounded-[8px]"
|
||||
style={{
|
||||
backgroundImage: `url('${item.icon}')`
|
||||
backgroundImage: `url('${item.icon}')`,
|
||||
backgroundSize: '100% 100%'
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
@ -56,7 +57,7 @@ export default defineComponent({
|
|||
</div>
|
||||
</div>
|
||||
))}
|
||||
<div class="w-12 h-16">
|
||||
{/* <div class="w-12 h-16">
|
||||
<div
|
||||
class="w-full h-10 rounded-lg overflow-hidden flex justify-center items-center p-2 transition-all cursor-pointer bg-white/40 hover:bg-white/60"
|
||||
onClick={() => {
|
||||
|
@ -66,7 +67,7 @@ export default defineComponent({
|
|||
>
|
||||
<OhVueIcon name="fa-plus" scale={1.4} fill="rgba(0,0,0,.4)" />
|
||||
</div>
|
||||
</div>
|
||||
</div> */}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import { addIcons, OhVueIcon } from 'oh-vue-icons'
|
|||
import { IoCloseCircleOutline, RiCloseCircleLine } from 'oh-vue-icons/icons'
|
||||
import useDiscountStore from './useDiscountStore'
|
||||
import { debounce } from 'lodash'
|
||||
import jump from '@/utils/jump'
|
||||
addIcons(RiTimeLine, IoCloseCircleOutline, RiCloseCircleLine)
|
||||
export default defineComponent(() => {
|
||||
const store = useDiscountStore()
|
||||
|
@ -13,7 +14,7 @@ export default defineComponent(() => {
|
|||
const container = containerRef.value
|
||||
if (store.loading) return
|
||||
if (container.scrollTop + container.clientHeight >= container.scrollHeight - 15) {
|
||||
store.state.pageIndex += 1;
|
||||
store.state.pageIndex += 1
|
||||
|
||||
store.getNews()
|
||||
}
|
||||
|
@ -25,7 +26,7 @@ export default defineComponent(() => {
|
|||
store.state.pageIndex = 1
|
||||
store.noMoreData = false
|
||||
store.getNews()
|
||||
}, 500) //
|
||||
}, 500) //
|
||||
watch(searchText, (newValue) => {
|
||||
debouncedHandler(newValue)
|
||||
})
|
||||
|
@ -57,7 +58,11 @@ export default defineComponent(() => {
|
|||
}
|
||||
}}
|
||||
></input>
|
||||
<div class={'absolute cursor-pointer hidden group-hover:block right-3 top-1/2 -translate-y-1/2'}>
|
||||
<div
|
||||
class={
|
||||
'absolute cursor-pointer hidden group-hover:block right-3 top-1/2 -translate-y-1/2'
|
||||
}
|
||||
>
|
||||
<OhVueIcon name={RiCloseCircleLine.name} fill="#ddd"></OhVueIcon>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -69,56 +74,61 @@ export default defineComponent(() => {
|
|||
ref={containerRef}
|
||||
>
|
||||
<div class={'grid grid-cols-3 gap-4 '}>
|
||||
{
|
||||
(store.state.find ? store.searchList :
|
||||
store.list).map((item, index) => {
|
||||
return (
|
||||
<div
|
||||
class={
|
||||
'flex cursor-pointer h-[215px] overflow-hidden bg-[#17212d] items-center flex-col rounded-lg relative '
|
||||
}
|
||||
onClick={() => { }}
|
||||
key={index}
|
||||
>
|
||||
<img class={'h-[142px] w-full object-cover'} src={item.commdity[0]?.img}></img>
|
||||
<div
|
||||
class={
|
||||
'absolute bottom-0 w-full h-[100px] rounded-lg bg-[#0003] backdrop-blur-md'
|
||||
}
|
||||
>
|
||||
<div class="flex flex-col w-full h-full justify-between py-2 px-3">
|
||||
<span class="text-white text-[14px]">{item.name}</span>
|
||||
<div>
|
||||
<span
|
||||
class={
|
||||
'border-[1px] border-[#f6d1b8] border-solid text-[#f6d1b8] p-1 text-[12px] rounded'
|
||||
}
|
||||
>
|
||||
{item.typename}
|
||||
</span>
|
||||
</div>
|
||||
<div class="bg-white/20 flex rounded items-center gap-x-2">
|
||||
<div class="bg-[#ef5a41] h-full text-white rounded px-2 text-[18px] font-bold ">
|
||||
-13%
|
||||
</div>
|
||||
<span class="text-[#fffbc2] text-[16px] ml-2">
|
||||
¥{item.commdity[0]?.price}
|
||||
</span>
|
||||
<span class="text-[12px] text-[#bdbdbd] line-through decoration-current">
|
||||
¥{item.commdity[0]?.oldprice}
|
||||
</span>
|
||||
<span class="text-[12px] text-[#ebebeb] ">
|
||||
剩余{1}天
|
||||
</span>
|
||||
</div>
|
||||
{(store.state.find ? store.searchList : store.list).map((item, index) => {
|
||||
return (
|
||||
<div
|
||||
class={
|
||||
'flex cursor-pointer h-[215px] overflow-hidden bg-[#17212d] items-center flex-col rounded-lg relative '
|
||||
}
|
||||
onClick={() => {
|
||||
// jump(item.commdity[0]?.url)
|
||||
window.open(item.commdity[0]?.url)
|
||||
}}
|
||||
key={index}
|
||||
>
|
||||
<img class={'h-[142px] w-full object-cover'} src={item.commdity[0]?.img}></img>
|
||||
<div
|
||||
class={
|
||||
'absolute bottom-0 w-full h-[100px] rounded-lg bg-[#0003] backdrop-blur-md'
|
||||
}
|
||||
>
|
||||
<div class="flex flex-col w-full h-full justify-between py-2 px-3">
|
||||
<span class="text-white text-[14px]">{item.name}</span>
|
||||
<div>
|
||||
<span
|
||||
class={
|
||||
'border-[1px] border-[#f6d1b8] border-solid text-[#f6d1b8] p-1 text-[12px] rounded'
|
||||
}
|
||||
>
|
||||
{item.typename}
|
||||
</span>
|
||||
</div>
|
||||
<div class="bg-white/20 flex rounded items-center gap-x-2">
|
||||
<div class="bg-[#ef5a41] h-full text-white rounded px-2 text-[18px] font-bold ">
|
||||
-13%
|
||||
</div>
|
||||
<span class="text-[#fffbc2] text-[16px] ml-2">
|
||||
¥{item.commdity[0]?.price}
|
||||
</span>
|
||||
<span class="text-[12px] text-[#bdbdbd] line-through decoration-current">
|
||||
¥{item.commdity[0]?.oldprice}
|
||||
</span>
|
||||
<span class="text-[12px] text-[#ebebeb] ">剩余{1}天</span>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
{store.loading && (
|
||||
<div class={'w-full font-bold flex absolute bottom-2 bg-[#17212d] justify-center text-white py-2'}>加载中...</div>
|
||||
<div
|
||||
class={
|
||||
'w-full font-bold flex absolute bottom-2 bg-[#17212d] justify-center text-white py-2'
|
||||
}
|
||||
>
|
||||
加载中...
|
||||
</div>
|
||||
)}
|
||||
{store.noMoreData && (
|
||||
<div class={'w-full font-bold flex justify-center text-white py-2'}>无更多数据</div>
|
||||
|
|
|
@ -114,6 +114,7 @@ export default defineComponent(() => {
|
|||
trriger.value &&
|
||||
<MilkdownProvider >
|
||||
<Editor
|
||||
|
||||
class={"w-full h-full "}
|
||||
modelValue={store.state.list[currentIndex.value]?.content || ''} onUpdate:modelValue={(e) => {
|
||||
if (store.state.list[currentIndex.value]) {
|
||||
|
|
|
@ -1,72 +1,63 @@
|
|||
import { Milkdown, useEditor } from '@milkdown/vue';
|
||||
import { defaultValueCtx, Editor, rootCtx } from '@milkdown/kit/core';
|
||||
import { Milkdown, useEditor } from '@milkdown/vue'
|
||||
import { defaultValueCtx, Editor, rootCtx } from '@milkdown/kit/core'
|
||||
import { nord } from '@milkdown/theme-nord'
|
||||
import { commonmark } from '@milkdown/kit/preset/commonmark'
|
||||
import { gfm } from '@milkdown/kit/preset/gfm';
|
||||
import { defineComponent, watch} from 'vue';
|
||||
import { gfm } from '@milkdown/kit/preset/gfm'
|
||||
import { defineComponent } from 'vue'
|
||||
import { menu, menuConfigCtx, type MenuConfigItem } from '@milkdown-lab/plugin-menu'
|
||||
import { listener, listenerCtx } from '@milkdown/kit/plugin/listener';
|
||||
|
||||
|
||||
import { listener, listenerCtx } from '@milkdown/kit/plugin/listener'
|
||||
const menuItems: MenuConfigItem[][] = [
|
||||
[
|
||||
{
|
||||
type: 'button',
|
||||
content: 'B',
|
||||
// commandKey
|
||||
key: 'ToggleStrong',
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
content: 'I',
|
||||
key: 'ToggleEmphasis',
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
content: 'S',
|
||||
key: 'ToggleStrikeThrough',
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
type: 'button',
|
||||
content: 'B',
|
||||
// commandKey
|
||||
key: 'ToggleStrong'
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
content: 'I',
|
||||
key: 'ToggleEmphasis'
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
content: 'S',
|
||||
key: 'ToggleStrikeThrough'
|
||||
}
|
||||
]
|
||||
]
|
||||
export default defineComponent({
|
||||
props: {
|
||||
modelValue: {
|
||||
type: String,
|
||||
default: '',
|
||||
}
|
||||
},
|
||||
emits: ['update:modelValue'],
|
||||
setup: (props, ct) => {
|
||||
|
||||
useEditor((root) => {
|
||||
return Editor.make()
|
||||
.config(nord)
|
||||
.config((ctx) => {
|
||||
const listener = ctx.get(listenerCtx);
|
||||
ctx.set(menuConfigCtx.key, {
|
||||
attributes: { class: 'milkdown-menu', 'data-menu': 'true' },
|
||||
items: menuItems,
|
||||
})
|
||||
ctx.set(rootCtx, document.querySelector('#app'))
|
||||
listener.markdownUpdated((ctx, markdown, prevMarkdown) => {
|
||||
if (markdown !== prevMarkdown) {
|
||||
ct.emit('update:modelValue', markdown)
|
||||
}
|
||||
})
|
||||
ctx.set(rootCtx, root)
|
||||
ctx.set(defaultValueCtx, props.modelValue || ' ')
|
||||
})
|
||||
.use(listener)
|
||||
.use(commonmark)
|
||||
.use(gfm)
|
||||
.use(menu)
|
||||
|
||||
|
||||
})
|
||||
return () => (
|
||||
<Milkdown />
|
||||
|
||||
)
|
||||
props: {
|
||||
modelValue: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
emits: ['update:modelValue'],
|
||||
setup: (props, ct) => {
|
||||
useEditor((root) => {
|
||||
return Editor.make()
|
||||
.config(nord)
|
||||
.config((ctx) => {
|
||||
const listener = ctx.get(listenerCtx)
|
||||
ctx.set(menuConfigCtx.key, {
|
||||
attributes: { class: 'milkdown-menu', 'data-menu': 'true' },
|
||||
items: menuItems
|
||||
})
|
||||
ctx.set(rootCtx, document.querySelector('#app'))
|
||||
listener.markdownUpdated((ctx, markdown, prevMarkdown) => {
|
||||
if (markdown !== prevMarkdown) {
|
||||
ct.emit('update:modelValue', markdown)
|
||||
}
|
||||
})
|
||||
ctx.set(rootCtx, root)
|
||||
ctx.set(defaultValueCtx, props.modelValue || ' ')
|
||||
})
|
||||
.use(listener)
|
||||
.use(commonmark)
|
||||
.use(gfm)
|
||||
.use(menu)
|
||||
})
|
||||
return () => <Milkdown />
|
||||
}
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue