Skip to content

Commit

Permalink
Merge pull request #38 from wiirhan/feat/components
Browse files Browse the repository at this point in the history
feat: add new components
  • Loading branch information
sdhushu authored Oct 11, 2023
2 parents a34df02 + d24d604 commit 5f7e169
Show file tree
Hide file tree
Showing 21 changed files with 3,298 additions and 3,787 deletions.
29 changes: 16 additions & 13 deletions components/editor/index.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts" setup>
import { computed, defineProps, onMounted, onUnmounted, Ref, ref, watch } from 'vue'
import { computed, onMounted, onUnmounted, Ref, ref, watch } from 'vue'
import { watchLang, watchTheme } from '@varlet/cli/client'
import {
Input as VarInput,
Expand Down Expand Up @@ -115,14 +115,12 @@ onUnmounted(() => {
window.addEventListener('message', handleMessage)
})
const editorItems = computed(() => {
return Object.keys(model.value).map((key) => {
return {
key,
inputVisible: ref(false),
}
})
})
const editorItems = computed(() =>
Object.keys(model.value).map((key) => ({
key,
inputVisible: ref(false),
}))
)
const clear = () => {
const { patch } = getPatch()
Expand Down Expand Up @@ -206,10 +204,15 @@ const handleInput = (model: any, key: { key: string; inputVisible: any }) => {

<template>
<div class="editor" ref="body">
<div v-for="key in editorItems" :key="key">
<var-input class="editor__input" :placeholder="key.key" v-model="model[key.key]" @input="handleInput(model, key)">
<template v-if="key.inputVisible.value" #append-icon>
<var-icon name="refresh" @click="handleRefresh(model, key)" />
<div v-for="item in editorItems" :key="item.key">
<var-input
class="editor__input"
:placeholder="item.key"
v-model="model[item.key]"
@input="handleInput(model, item)"
>
<template v-if="item.inputVisible.value" #append-icon>
<var-icon name="refresh" @click="handleRefresh(model, item)" />
</template>
</var-input>
</div>
Expand Down
19 changes: 10 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,19 @@
"create": "varlet-cli create"
},
"dependencies": {
"@varlet/ui": "^2.9.2",
"@types/file-saver": "^2.0.5",
"@varlet/ui": "^2.17.1",
"@varlet/use": "^2.17.1",
"file-saver": "^2.0.5",
"jszip": "^3.10.1"
},
"devDependencies": {
"@varlet/cli": "^2.8.4-alpha.1676992435486",
"@varlet/eslint-config": "^2.8.3",
"@varlet/icons": "^2.8.4-alpha.1676992435486",
"@varlet/shared": "^2.8.3",
"@varlet/stylelint-config": "^2.8.3",
"@varlet/touch-emulator": "^2.8.4-alpha.1676992435486",
"@varlet/cli": "^2.17.1",
"@varlet/eslint-config": "^2.17.1",
"@varlet/icons": "^2.17.1",
"@varlet/shared": "^2.17.1",
"@varlet/stylelint-config": "^2.11.8",
"@varlet/touch-emulator": "^2.17.1",
"@vue/test-utils": "^2.0.2",
"clipboard": "^2.0.6",
"eslint": "^7.30.0",
Expand Down Expand Up @@ -82,8 +83,8 @@
"Chrome >= 54",
"iOS >= 10"
],
"packageManager": "pnpm@7.9.0",
"packageManager": "pnpm@8.7.5",
"engines": {
"pnpm": ">=7.9"
"pnpm": ">=8.0"
}
}
Loading

0 comments on commit 5f7e169

Please sign in to comment.