This commit is contained in:
parent
c22510574e
commit
45bed5fe39
@ -25,6 +25,7 @@
|
||||
"preview": "vite preview --port 4173"
|
||||
},
|
||||
"dependencies": {
|
||||
"@riophae/vue-treeselect": "^0.4.0",
|
||||
"@vicons/ionicons5": "^0.12.0",
|
||||
"@vueup/vue-quill": "^1.2.0",
|
||||
"@wangeditor/editor": "^5.1.23",
|
||||
|
37
src/api/cookbook/index.js
Normal file
37
src/api/cookbook/index.js
Normal file
@ -0,0 +1,37 @@
|
||||
import request from '@/util/request';
|
||||
|
||||
//poetry
|
||||
export function category(params) {
|
||||
return request({
|
||||
url: '/cookbook/category',
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
}
|
||||
|
||||
// detail
|
||||
export function detail(params) {
|
||||
return request({
|
||||
url: '/cookbook/detail',
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
}
|
||||
|
||||
// list
|
||||
export function list(params) {
|
||||
return request({
|
||||
url: '/cookbook/list',
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
}
|
||||
|
||||
// search
|
||||
export function search(params) {
|
||||
return request({
|
||||
url: '/cookbook/search',
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
}
|
@ -38,6 +38,10 @@ const router = createRouter({
|
||||
path: "/plink",
|
||||
component: () => import("@/views/plink/index.vue"),
|
||||
},
|
||||
{
|
||||
path: "/cookbook",
|
||||
component: () => import("@/views/cookbook/index.vue"),
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -26,9 +26,13 @@ const menuInfo = {
|
||||
},
|
||||
{
|
||||
key: "5",
|
||||
label: () => h(RouterLink, { to: "/cookbook", class: "menu-item font-[500] text-lg" }, { default: () => "菜谱" }),
|
||||
},
|
||||
{
|
||||
key: "6",
|
||||
label: () => h(RouterLink, { to: "/plink", class: "menu-item font-[500] text-lg" }, { default: () => "友链" }),
|
||||
},
|
||||
],
|
||||
menuList: ["/home", "/gallery", "/article", "/widget","/plink"],
|
||||
menuList: ["/home", "/gallery", "/article", "/widget","/cookbook","/plink"],
|
||||
};
|
||||
export default menuInfo;
|
||||
|
62
src/views/cookbook/index.vue
Normal file
62
src/views/cookbook/index.vue
Normal file
@ -0,0 +1,62 @@
|
||||
<template>
|
||||
<!-- <div class="1st"> --><n-space vertical>
|
||||
<n-cascader class="w-[540px]" v-model:value="category" placeholder="请选择分类" :options="clist" check-strategy="child"
|
||||
:show-path="true" remote ellipsis-tag-popover-props :on-load="hl" />
|
||||
</n-space>
|
||||
|
||||
<!-- </div> -->
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onBeforeMount } from 'vue';
|
||||
|
||||
|
||||
|
||||
//mark import
|
||||
|
||||
//mark data
|
||||
const category = ref(null)
|
||||
const clist = ref([])
|
||||
//mark method
|
||||
async function getCate(id) {
|
||||
const res = await $http.cookbook.category({ id });
|
||||
// console.log(res);
|
||||
return res.data;
|
||||
}
|
||||
function hl(option) {
|
||||
return getChildren(option)
|
||||
// return children;
|
||||
}
|
||||
async function getChildren(option) {
|
||||
console.log(option);
|
||||
|
||||
const children = [];
|
||||
const res = await getCate(option.value);
|
||||
res.forEach(item => {
|
||||
children.push({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
depth: option.depth + 1,
|
||||
isLeaf: option.depth === 2
|
||||
});
|
||||
});
|
||||
option.children = children;
|
||||
}
|
||||
|
||||
//mark 周期、内置函数等
|
||||
onBeforeMount(async () => {
|
||||
const res = await $http.cookbook.category({ id: -1 })
|
||||
clist.value = res.data;
|
||||
clist.value.forEach(item => {
|
||||
item.label = item.name;
|
||||
item.value = item.id;
|
||||
item.isLeaf = false;
|
||||
item.depth = 1;
|
||||
});
|
||||
console.log(clist.value);
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
48
yarn.lock
48
yarn.lock
@ -44,7 +44,7 @@
|
||||
core-js-pure "^3.30.2"
|
||||
regenerator-runtime "^0.14.0"
|
||||
|
||||
"@babel/runtime@^7.12.0":
|
||||
"@babel/runtime@^7.12.0", "@babel/runtime@^7.3.1":
|
||||
version "7.26.0"
|
||||
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.26.0.tgz#8600c2f595f277c60815256418b85356a65173c1"
|
||||
integrity sha512-FDSOghenHTiToteC/QRlv2q3DhPZ/oOXTBoirfWNx1Cx3TMVcGWQtMMmQcSvb/JjpNeGzx8Pq/b4fKEJuWm1sw==
|
||||
@ -171,6 +171,20 @@
|
||||
resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33"
|
||||
integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==
|
||||
|
||||
"@riophae/vue-treeselect@^0.4.0":
|
||||
version "0.4.0"
|
||||
resolved "https://registry.yarnpkg.com/@riophae/vue-treeselect/-/vue-treeselect-0.4.0.tgz#0baed5a794cffc580b63591f35c125e51c0df241"
|
||||
integrity sha512-J4atYmBqXQmiPFK/0B5sXKjtnGc21mBJEiyKIDZwk0Q9XuynVFX6IJ4EpaLmUgL5Tve7HAS7wkiGGSti6Uaxcg==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.3.1"
|
||||
babel-helper-vue-jsx-merge-props "^2.0.3"
|
||||
easings-css "^1.0.0"
|
||||
fuzzysearch "^1.0.3"
|
||||
is-promise "^2.1.0"
|
||||
lodash "^4.0.0"
|
||||
material-colors "^1.2.6"
|
||||
watch-size "^2.0.0"
|
||||
|
||||
"@rollup/pluginutils@^5.1.3":
|
||||
version "5.1.4"
|
||||
resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-5.1.4.tgz#bb94f1f9eaaac944da237767cdfee6c5b2262d4a"
|
||||
@ -960,6 +974,11 @@ axios@^1.7.4, axios@^1.7.7:
|
||||
form-data "^4.0.0"
|
||||
proxy-from-env "^1.1.0"
|
||||
|
||||
babel-helper-vue-jsx-merge-props@^2.0.3:
|
||||
version "2.0.3"
|
||||
resolved "https://registry.yarnpkg.com/babel-helper-vue-jsx-merge-props/-/babel-helper-vue-jsx-merge-props-2.0.3.tgz#22aebd3b33902328e513293a8e4992b384f9f1b6"
|
||||
integrity sha512-gsLiKK7Qrb7zYJNgiXKpXblxbV5ffSwR0f5whkPAaBAR4fhi6bwRZxX9wBlIc5M/v8CCkXUbXZL4N/nSE97cqg==
|
||||
|
||||
balanced-match@^1.0.0:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee"
|
||||
@ -1341,6 +1360,11 @@ dunder-proto@^1.0.0:
|
||||
es-errors "^1.3.0"
|
||||
gopd "^1.2.0"
|
||||
|
||||
easings-css@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/easings-css/-/easings-css-1.0.0.tgz#dde569003bb7a4a0c0b77878f5db3e0be5679c81"
|
||||
integrity sha512-7Uq7NdazNfVtr0RNmPAys8it0zKCuaqxJStYKEl72D3j4gbvXhhaM7iWNbqhA4C94ygCye6VuyhzBRQC4szeBg==
|
||||
|
||||
eastasianwidth@^0.2.0:
|
||||
version "0.2.0"
|
||||
resolved "https://registry.yarnpkg.com/eastasianwidth/-/eastasianwidth-0.2.0.tgz#696ce2ec0aa0e6ea93a397ffcf24aa7840c827cb"
|
||||
@ -1697,6 +1721,11 @@ functions-have-names@^1.2.3:
|
||||
resolved "https://registry.yarnpkg.com/functions-have-names/-/functions-have-names-1.2.3.tgz#0404fe4ee2ba2f607f0e0ec3c80bae994133b834"
|
||||
integrity sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==
|
||||
|
||||
fuzzysearch@^1.0.3:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/fuzzysearch/-/fuzzysearch-1.0.3.tgz#dffc80f6d6b04223f2226aa79dd194231096d008"
|
||||
integrity sha512-s+kNWQuI3mo9OALw0HJ6YGmMbLqEufCh2nX/zzV5CrICQ/y4AwPxM+6TIiF9ItFCHXFCyM/BfCCmN57NTIJuPg==
|
||||
|
||||
get-intrinsic@^1.2.4, get-intrinsic@^1.2.5, get-intrinsic@^1.2.6:
|
||||
version "1.2.6"
|
||||
resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.2.6.tgz#43dd3dd0e7b49b82b2dfcad10dc824bf7fc265d5"
|
||||
@ -1881,6 +1910,11 @@ is-plain-object@^5.0.0:
|
||||
resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-5.0.0.tgz#4427f50ab3429e9025ea7d52e9043a9ef4159344"
|
||||
integrity sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==
|
||||
|
||||
is-promise@^2.1.0:
|
||||
version "2.2.2"
|
||||
resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.2.2.tgz#39ab959ccbf9a774cf079f7b40c7a26f763135f1"
|
||||
integrity sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ==
|
||||
|
||||
is-regex@^1.1.4:
|
||||
version "1.2.1"
|
||||
resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.2.1.tgz#76d70a3ed10ef9be48eb577887d74205bf0cad22"
|
||||
@ -2032,7 +2066,7 @@ lodash.toarray@^4.4.0:
|
||||
resolved "https://registry.yarnpkg.com/lodash.toarray/-/lodash.toarray-4.4.0.tgz#24c4bfcd6b2fba38bfd0594db1179d8e9b656561"
|
||||
integrity sha512-QyffEA3i5dma5q2490+SgCvDN0pXLmRGSyAANuVi0HQ01Pkfr9fuoKQW8wm1wGBnJITs/mS7wQvS6VshUEBFCw==
|
||||
|
||||
lodash@^4.15.0, lodash@^4.17.21:
|
||||
lodash@^4.0.0, lodash@^4.15.0, lodash@^4.17.21:
|
||||
version "4.17.21"
|
||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
|
||||
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
|
||||
@ -2062,6 +2096,11 @@ marked@4.3.0:
|
||||
resolved "https://registry.yarnpkg.com/marked/-/marked-4.3.0.tgz#796362821b019f734054582038b116481b456cf3"
|
||||
integrity sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==
|
||||
|
||||
material-colors@^1.2.6:
|
||||
version "1.2.6"
|
||||
resolved "https://registry.yarnpkg.com/material-colors/-/material-colors-1.2.6.tgz#6d1958871126992ceecc72f4bcc4d8f010865f46"
|
||||
integrity sha512-6qE4B9deFBIa9YSpOc9O0Sgc43zTeVYbgDT5veRKSlB2+ZuHNoVVxA1L/ckMUayV9Ay9y7Z/SZCLcGteW9i7bg==
|
||||
|
||||
math-intrinsics@^1.0.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/math-intrinsics/-/math-intrinsics-1.1.0.tgz#a0dd74be81e2aa5c2f27e65ce283605ee4e2b7f9"
|
||||
@ -3172,6 +3211,11 @@ vueuc@^0.4.63:
|
||||
vdirs "^0.1.4"
|
||||
vooks "^0.2.4"
|
||||
|
||||
watch-size@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/watch-size/-/watch-size-2.0.0.tgz#096ee28d0365bd7ea03d9c8bf1f2f50a73be1474"
|
||||
integrity sha512-M92R89dNoTPWyCD+HuUEDdhaDnh9jxPGOwlDc0u51jAgmjUvzqaEMynXSr3BaWs+QdHYk4KzibPy1TFtjLmOZQ==
|
||||
|
||||
web-streams-polyfill@^3.0.3:
|
||||
version "3.3.3"
|
||||
resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz#2073b91a2fdb1fbfbd401e7de0ac9f8214cecb4b"
|
||||
|
Loading…
Reference in New Issue
Block a user