first commit

This commit is contained in:
编码猿
2024-09-27 02:06:13 +08:00
commit 852d94fbb9
36760 changed files with 3274413 additions and 0 deletions

View File

@@ -0,0 +1,73 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>组件</title>
</head>
<body>
<div class="app">
<lb-header text="测试" :list-arr="newsList"></lb-header>
<div class="content">内容部分</div>
</div>
</body>
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>
<script>
Vue.component('lb-header', {
template: `
<div class="header">
<h2>{{text}}</h2>
<ul>
<li v-for="item,index in listArr">{{item.title}}</li>
</ul>
<div class="right">
</div>
</div>
`,
props: {
text: {
default: '默认参数',
type: String,
required: true
},
listArr: {
default: () => [],
type: Array
}
},
data() {
return {
}
}
});
// 局部组件
var vm = new Vue({
el: '.app',
data: {
test: '你好',
title: '首页',
newsList: [
{ id: 1, title: '新闻1', href: 'https://www.baidu.com/' },
{ id: 2, title: '新闻2', href: 'https://www.baidu.com/' },
{ id: 3, title: '新闻3', href: 'https://www.baidu.com/' },
]
},
mounted() {
console.log("mounted");
console.log(this.test);
},
methods: {
}
})
</script>
</html>

View File

@@ -0,0 +1,83 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
* {
margin: 0;
padding: 0;
list-style: none;
}
ul {
display: flex;
}
.tabs_title {
height: 45px;
align-items: center;
}
.tabs_title li {
margin: 0 10px;
}
.tabs_content li {
display: none;
}
.active_content {
display: block !important;
}
.active_title {
color: red;
}
</style>
</head>
<body>
<div class="app">
<ul class="tabs_title">
<li :class="index == currentIndex ? 'active_title' : '' " @click="changeActive(index)"
v-for="item,index in tabs">
{{ item.title }}
</li>
</ul>
<ul class="tabs_content">
<li :class="index == currentIndex ? 'active_content' : '' " v-for="item,index in tabs">
{{ item.content }}
</li>
</ul>
</div>
</body>
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>
<script>
new Vue({
el: '.app',
data: {
currentIndex: 0,
tabs: [
{ id: 1, title: '首页', content: '首页 的内容' },
{ id: 2, title: '社会', content: '社会 的内容' },
{ id: 3, title: '财经', content: '财经 的内容' },
{ id: 4, title: '体育', content: '体育 的内容' },
]
},
methods: {
changeActive(index) {
console.log(index);
this.currentIndex = index
}
}
})
</script>
</html>

View File

@@ -0,0 +1,80 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div class="app">
<v-swiper :list="newsList">
<template #html="{ item }">
<img :src="item.src">
</template>
</v-swiper>
<v-swiper :list="dd">
<template #html="{ item }">
<a :href="item.href">{{ item.title }}</a>
</template>
</v-swiper>
</div>
</body>
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>
<script>
Vue.component('v-swiper', {
template: `
<div class="swiper">
<li v-for="item,index in list">
<slot name="html" v-bind:item="item"></slot>
</li>
</div>
`,
props: {
list: {
default: () => [],
type: Array
}
},
data() {
return {
}
}
});
var vm = new Vue({
el: '.app',
data: {
newsList: [
{ id: 1, title: '新闻1', src: 'https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png' },
{ id: 2, title: '新闻2', src: 'https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png' },
{ id: 3, title: '新闻3', src: 'https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png' },
],
dd: [
{ id: 1, title: '新闻1', href: 'https://www.baidu.com' },
{ id: 2, title: '新闻2', href: 'https://cn.vuejs.org/v2/guide/components-slots.html#%E4%BD%9C%E7%94%A8%E5%9F%9F%E6%8F%92%E6%A7%BD' },
{ id: 3, title: '新闻3', href: 'https://www.bilibili.com/' },
]
},
mounted() {
},
methods: {
}
})
</script>
</html>