...
 
Commits (7)
    https://gitcode.net/f1dao/undraw-ui/-/commit/c44a4cd0f2d59f60bbd0ba90877b40eb281194e7 fix: 🐛 修复el-input样式影响 2023-04-20T08:23:30+08:00 readpage f1dao@qq.com https://gitcode.net/f1dao/undraw-ui/-/commit/bdb44582be80b0ff2bc8946d8df01fac72311642 fix: 🐛 [comment] like多次触发点赞数量不对 2023-04-20T15:15:43+08:00 f1dao f1dao@qq.com link #I6WR4H https://gitcode.net/f1dao/undraw-ui/-/commit/a2576218abd7d3b2170df53231920ebbd155ec9c chore: 🔨 配置 2023-04-20T17:51:26+08:00 f1dao f1dao@qq.com https://gitcode.net/f1dao/undraw-ui/-/commit/b7cbc6fb63f964815d7643d00eefe19606725d16 feat: ✨ cdn引用 2023-04-20T20:29:23+08:00 readpage f1dao@qq.com https://gitcode.net/f1dao/undraw-ui/-/commit/14f5155b2f7804c9b0aec65280687181be58b1f4 update LICENSE. 2023-04-20T12:38:30+00:00 readpage f1dao@qq.com Signed-off-by: <span data-trailer="Signed-off-by:"><a href="mailto:f1dao@qq.com" title="f1dao@qq.com"></a><a href="javascript:void(0)" class="avatar s16 avatar-inline identicon bg1" style="text-decoration: none">N</a><a href="mailto:f1dao@qq.com" title="f1dao@qq.com">readpage</a> &lt;<a href="mailto:f1dao@qq.com" title="f1dao@qq.com">f1dao@qq.com</a>&gt;</span> https://gitcode.net/f1dao/undraw-ui/-/commit/17a9083f7877f2554e718471b0383e5d4b9207f6 删除文件 LICENSE 2023-04-20T12:40:16+00:00 readpage f1dao@qq.com https://gitcode.net/f1dao/undraw-ui/-/commit/59d5426fb53a97c3e67042f039871857af34dd03 💖 2023-04-20T12:42:04+00:00 readpage f1dao@qq.com Signed-off-by: <span data-trailer="Signed-off-by:"><a href="mailto:f1dao@qq.com" title="f1dao@qq.com"></a><a href="javascript:void(0)" class="avatar s16 avatar-inline identicon bg6" style="text-decoration: none">N</a><a href="mailto:f1dao@qq.com" title="f1dao@qq.com">readpage</a> &lt;<a href="mailto:f1dao@qq.com" title="f1dao@qq.com">f1dao@qq.com</a>&gt;</span>
MIT License
Copyright (c) 2022 封印之剑
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
MIT License
Copyright (c) 2023 readpage
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
import { UndrawUi } from '~/index';
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue' // 处理vue文件
import DefineOptions from 'unplugin-vue-define-options/vite'
......@@ -34,23 +33,24 @@ export default defineConfig({
build: {
// 打包输出目录
outDir: output,
minify: true, //是否进行压缩
lib: {
entry: resolve(input, 'index.ts'),
name: 'UndrawUi',
fileName: () => 'index.js',
formats: ['es']
name: 'UndrawUi', // umd的变量名
fileName: (format) => `index.${format}.js`,
// 输出格式
formats: ['es', 'umd']
},
rollupOptions: {
output: {
exports: 'named',
// 在 UMD 构建模式下为这些外部化的依赖提供一个全局变量
globals: {
vue: 'Vue',
'element-plus': 'ElementPlus',
'element-plus': 'ElementPlus'
}
},
// 打包过滤掉第三方库
external: ['vue', 'element-plus']
external: ['vue', 'element-plus', '@element-plus/icons-vue']
}
}
})
......@@ -178,7 +178,6 @@ const submit = ({ content, parentId, files, finish }: SubmitParamApi) => {
// 点赞按钮事件
const like = (id: string, finish: () => void) => {
console.log('点赞: ' + id)
console.log(id)
setTimeout(() => {
finish()
}, 200)
......
......@@ -4,4 +4,4 @@
非常感谢! 💖
![support.jpg](https://s2.loli.net/2023/03/25/DQLMFwBv2PWydsX.jpg)
\ No newline at end of file
![support.jpg](https://s1.vika.cn/space/2023/04/09/53cb1adbddc640d1b6bedb5d381bf5de)
\ No newline at end of file
......@@ -4,122 +4,124 @@ sidebar: false
## 0.9.0
***2023-03-24***
### feat
### 新增
- 导航栏nav卡槽(排序)
- [comment-scroll]滚动加载更多评论组件
- 用户信息卡槽
### fix
### 修复
- 修复评论后未清空图片、按钮禁用
### refactor
### 重构
- 防抖和节流
- [comment] 用户信息结构
- [comment] 重构工具栏功能
- [comment] 参数、接口方法、上传、工具栏、回复分页可选,用户信息和用户信息卡片
## 0.8.2
**修复**
fix: 🐛 [comment] 修复用户信息hover事件移动到卡片消失问题、删除全局a元素样式
## 0.8.2
***2023-03-01***
***
### 修复
- [comment] 修复用户信息hover事件移动到卡片消失问题、删除全局a元素样式
- 修复package.json配置错误问题
- [comment] 修改评论对象属性名
fix: 🐛 修复package.json配置错误问题
### 新增
fix: 🐛 [comment] 修改评论对象属性名
- feat: ✨ [comment] 新增图片文件上传功能
**新增**
feat: ✨ [comment] 新增图片文件上传功能
## 0.7.2
### 2022/11/16
**修复**
fix: 🐛 [search] 修复搜索框占用空间的问题
***2022/11/16***
### 修复
- fix: 🐛 [search] 修复搜索框占用空间的问题
**优化**
### 优化
- chore: [comment] 优化更多分页
chore: [comment] 优化更多分页
**新增**
feat: ✨ [counter] 新增counter 动态数字滚动组件
### 新增
- feat: ✨ [counter] 新增counter 动态数字滚动组件
## 0.6.9
###
### 2022/10/7
**修复**
***2022/10/7**
### 修复
- fix: 🐛 [search] 解决localStorage存储store未定义问题
- fix: 🐛 [search] 修复config数据无法响应式问题
**优化**
### 优化
- chore: 🔨 util 新增deep方法
- chore: 🔨 [tags] 修改事件方法
## 0.6.4
### 2022/9/22
**增强**
***2022/9/22***
### 增强
- [comment] 添加删除功能
**优化**
### 优化
- [comment] 优化评论提交和点赞功能
- [chat] 添加聊天个人评论框样式
- [dialog] 修改样式
- [notice-bar] 修复右键关闭和全部关闭异常
**修复**
### 修复
- [comment] 修复vue-cli图片加载错误
## 0.5.9
### 2022/8/21
**新增组件**
***2022/8/21***
### 新增组件
- [chat] 新增聊天组件
**增强**
### 增强
- [comment] 新增查看用户信息、新增回复分页
## 0.5.7
### 2022/6/23
**修复**
***2022/6/23***
### 修复
- [Anchor] 滚动轴失效
**增强**
### 增强
- [Anchor] 新增 target-offset属性,距离窗口顶部达到指定偏移量
## 0.5.6
### 2022/6/22
**新增组件**
***2022/6/22***
### 新增组件
- Search 搜索(input关键词滚动,搜索日志,热搜)
**增强**
### 增强
- [Comment] 新增ip地址
## 0.5.1
### 2022/5/20
**修复**
***2022/5/20***
### 修复
- Comment 个人主页跳转,等级
## 0.5.0
### 2022/5/19
**增强**
***2022/5/19***
### 增强
- Comment 点赞,等级,当前用户
## 0.4.8
### 2022/4/30
**新增**
***2022/4/30***
### 新增
- Anchor 锚点
## 0.4.4
### 2022/4/27
**更新**
***2022/4/27***
### 更新
- 新增标签页
- 新增通知栏
此差异已折叠。
{
"name": "undraw-ui",
"private": false,
"version": "0.9.0",
"version": "0.9.3",
"type": "module",
"author": "readpage <f1dao@qq.com>",
"repository": {
"type": "git",
......@@ -17,8 +18,11 @@
],
"homepage": "https://undraw.gitee.io/undraw-ui/",
"license": "MIT",
"main": "./dist/index.js",
"style": "./dist/style.css",
"main": "dist/index.es.js",
"unpkg": "dist/index.umd.js",
"jsdelivr": "dist/index.umd.js",
"types": "dist/index.d.ts",
"style": "dist/style.css",
"scripts": {
"dev": "vite",
"build": "vue-tsc --noEmit && vite build",
......@@ -33,8 +37,9 @@
}
},
"dependencies": {
"@element-plus/icons-vue": "^2.0.9",
"element-plus": "^2.1.8",
"@element-plus/icons-vue": "^2.1.0",
"@vueuse/core": "^9.3.0",
"element-plus": "^2.2.0",
"store": "^2.0.12",
"vue": "^3.2.31"
},
......
......@@ -112,6 +112,7 @@ onMounted(() => {
})
onUnmounted(() => {
scroll.value.removeEventListener('scroll', onScroll)
observer.disconnect()
})
</script>
......
......@@ -41,6 +41,7 @@ import {
InjectReplyBoxApi,
SubmitParam2Api
} from '../key'
import { throttle } from 'lodash'
defineOptions({
name: 'UComment'
})
......@@ -103,42 +104,40 @@ const inputBoxParam: InjectInputBoxApi = {
// 输入框盒子
provide(InjectInputBox, inputBoxParam)
// 点赞评论数组处理
const editLikeCount = (id: string, count: number) => {
let tar = null
comments.value.forEach(v => {
if (v.id == id) {
tar = v
} else {
tar = v.reply?.list.find(v => v.id == id)
}
if (tar) {
tar.likes += count
}
})
}
/**
* 点赞事件
* @param id
*/
const like = (id: string) => {
// 点赞评论数组处理
const editLike = (id: string, count: number) => {
let tar = null
comments.value.forEach(v => {
if (v.id != id) {
tar = v.reply?.list.find(v => v.id == id)
} else {
tar = v
}
if (tar) {
tar.likes += count
}
})
}
// 点赞事件处理
const likeIds = props.config.user.likeIds
let temp = likeIds.map(String)
emit('like', id, () => {
if (temp.indexOf(id) == -1) {
if (likeIds.findIndex(item => item == id) == -1) {
// 点赞
likeIds.push(id as never)
editLike(id, 1)
editLikeCount(id, 1)
} else {
// 取消点赞
let index = temp.findIndex(item => item == id)
if (index != -1) likeIds.splice(index, 1)
editLike(id, -1)
let index = likeIds.findIndex(item => item == id)
if (index != -1) {
likeIds.splice(index, 1)
editLikeCount(id, -1)
}
}
})
}
......@@ -152,9 +151,6 @@ const contentBoxParam: InjectContentBoxApi = {
}
provide(InjectContentBox, contentBoxParam)
// 回复盒子
const replyBoxParam: InjectReplyBoxApi = {
page: props.page,
......@@ -166,9 +162,6 @@ const replyBoxParam: InjectReplyBoxApi = {
}
provide(InjectReplyBox, replyBoxParam)
/**
* 删除当前评论
* @param comment
......@@ -213,9 +206,6 @@ const operation: InjectOperationApi = {
}
provide(InjectOperation, operation)
// 表情包
provide(InjectionEmojiApi, props.config.emoji)
......
......@@ -2,9 +2,9 @@
<div class="u-sign">
<el-button link @click="visible = true">登录/注册</el-button>
<u-dialog v-model="visible" :title="title" width="320px" top="30vh" :close-on-click-modal="false">
<img v-if="toggle == 0" class="sign-img normal" src="/static/img/normal.webp" alt="" />
<!-- <img v-if="toggle == 0" class="sign-img normal" src="/static/img/normal.webp" alt="" />
<img v-else-if="toggle == 1" class="sign-img greeting" src="/static/img/greeting.webp" alt="" />
<img v-else class="sign-img blindfold" src="/static/img/blindfold.webp" alt="" />
<img v-else class="sign-img blindfold" src="/static/img/blindfold.webp" alt="" /> -->
<formVue v-model="type" @toggle="val => (toggle = val)" @submit="form => $emit('submit', form)" />
<u-divider>其他方式登录</u-divider>
<div class="sign-oauth">
......
......@@ -65,24 +65,25 @@ watch(
() => [...tagsList.value],
(val, oldVal) => {
if (oldVal) {
console.log(val, oldVal)
if (val.length > oldVal.length) {
//新增目标元素id
let tag = val.find(v => !oldVal?.includes(v))
// 删除相同的元素
tagsList.value.forEach((item, index, self) => {
if (self.findIndex(v => v.meta.title == item.meta.title) != index) {
if (self.findIndex(v => v.path == item.path) != index) {
self.splice(index, 1)
}
})
active.value = tagsList.value.findIndex(v => v.meta.title == tag?.meta.title)
active.value = tagsList.value.findIndex(v => v.path == tag?.path)
}
} else {
let flag = 1
// 删除相同的元素
tagsList.value.forEach((item, index, self) => {
if (self.findIndex(v => v.meta.title == item.meta.title) != index) {
if (self.findIndex(v => v.path == item.path) != index) {
self.splice(index, 1)
active.value = self.findIndex(v => v.meta.title == item.meta.title)
active.value = self.findIndex(v => v.path == item.path)
flag = 0
}
})
......
export { ElTag } from 'element-plus'
import 'element-plus/es/components/tag/style/css'
......@@ -6,10 +6,14 @@ export * from './element'
export * from './hooks'
export * from './util'
const install = (app: App) => {
components.forEach(item => {
app.use(item)
})
}
export { install }
export default {
install: (app: App) => {
components.forEach(item => {
app.use(item)
})
}
install
}
......@@ -12,6 +12,10 @@
* 鼠标移动事件;
* 用户频繁点击按钮操作;
* 游戏中的一些设计;
*
*
* 节流的应用场景:
* 鼠标连续不断地触发某事件(如点击),只在单位时间内只触发一次;
*/
/**
......
import { useDark } from '@vueuse/core'
export const isDark = useDark()
......@@ -7,3 +7,5 @@ export * from './storage'
export * from './core'
export * from './basic'
export * from './convert'
export * from './dark'