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,56 @@
<!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>vue练习</title>
</head>
<body>
<div class="app">
<h2>{{message}}</h2>
<a v-bind:href="aParams.href">{{aParams.title}}</a>
<ul>
<li v-for="v,i in newsList" :key="i">{{i}} |{{v.title}}</li>
</ul>
<div v-if="vip == 0">普通</div>
<div v-else-if="vip == 1">会员</div>
<div v-else>超级会员</div>
<input v-model="userName" type="text" placeholder="输入用户名">
<input v-model="userPwd" type="password" placeholder="输入密码">
<button @click="Login" >登录</button>
</div>
</body>
<script src="https://cdn.jsdelivr.net/npm/vue@2.7.14/dist/vue.js"></script>
<script>
var vm = new Vue({
el:'.app',
data:{
message: '我的第一次vue',
vip: 2,
userPwd: '',
userName: '',
aParams: {
title: '点击我',
href: 'https://www.baidu.com/'
},
newsList: [
{ id: 1, title: '新闻1', content: '<h2>你好1</h2>' },
{ id: 2, title: '新闻3', content: '<h2>你好2</h2>' },
{ id: 3, title: '新闻4', content: '<h2>你好3</h2>' }
]
},
methods: {
Login() {
console.log("登录");
// console.log("用户登录:", this.userPwd, this.userName);
},
test() {
console.log("test");
}
},
})
</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>
<style>
* {
margin: 0;
padding: 0;
list-style: none;
}
.title {
display: flex;
}
.title li {
margin-right: 20px;
}
.title .active {
color: red;
}
.content li {
display: none;
}
.content .active {
display: block;
}
</style>
</head>
<body>
<div class="app">
<ul class="title">
<li v-for="v,i in tabList"
:class=" i == index ? 'active' : '' "
@click=" index = i "
>{{ v.title }}</li>
</ul>
<ul class="content">
<li v-for="v,i in tabList" :class="i == index ? 'active' : '' ">{{ v.content }}</li>
</ul>
</div>
</body>
<script src="https://cdn.jsdelivr.net/npm/vue@2.7.14/dist/vue.js"></script>
<script>
new Vue({
el: '.app',
data: {
index: 0,
tabList: [
{
title: '社会',
content: "社会 的内容"
},
{
title: '体育',
content: "体育 的内容"
},
{
title: '军事',
content: "军事 的内容"
},
{
title: '科技',
content: "科技 的内容"
},
]
},
})
</script>
</html>

View File

@@ -0,0 +1,62 @@
<!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>router</title>
</head>
<body>
<div id="app">
<h1>Hello App!</h1>
<p>
<!-- 使用 router-link 组件来导航. -->
<!-- 通过传入 `to` 属性指定链接. -->
<!-- <router-link> 默认会被渲染成一个 `<a>` 标签 -->
<router-link to="/foo">Go to Foo</router-link>
<router-link to="/bar">Go to Bar</router-link>
</p>
<!-- 路由出口 -->
<!-- 路由匹配到的组件将渲染在这里 -->
<router-view></router-view>
</div>
</body>
<script src="https://unpkg.com/vue@2/dist/vue.js"></script>
<script src="https://unpkg.com/vue-router@3/dist/vue-router.js"></script>
<script>
// 1. 定义 (路由) 组件。
// 可以从其他文件 import 进来
const Foo = { template: '<div>foo</div>' }
const Bar = { template: '<div>bar</div>' }
// 2. 定义路由
// 每个路由应该映射一个组件。 其中"component" 可以是
// 通过 Vue.extend() 创建的组件构造器,
// 或者,只是一个组件配置对象。
// 我们晚点再讨论嵌套路由。
const routes = [
{ path: '/foo', component: Foo },
{ path: '/bar', component: Bar }
]
// 3. 创建 router 实例,然后传 `routes` 配置
// 你还可以传别的配置参数, 不过先这么简单着吧。
const router = new VueRouter({
routes // (缩写) 相当于 routes: routes
})
// 4. 创建和挂载根实例。
// 记得要通过 router 配置参数注入路由,
// 从而让整个应用都有路由功能
const app = new Vue({
el: '#app',
router
})
// .$mount('#app')
</script>
</html>