<template> <div class="form_container"> <div class="manage_tip"> <img :src="defaultImg" /> <span class="title">后台管理系统</span> <el-form :model="loginUser" status-icon :rules="rules" ref="loginForm" class="loginForm" label-width="80px"> <el-form-item label="账号" prop="account"> <el-input v-model="loginUser.account" placeholder="请输入账号"></el-input> </el-form-item> <el-form-item label="密码" prop="credential"> <el-input type="password" v-model="loginUser.credential" placeholder="请输入密码"></el-input> </el-form-item> <el-form-item> <el-button type="primary" class="submit_btn" @click="submitForm('loginForm')">登录</el-button> </el-form-item> <!-- <div class="info"> <p>还没有账号,请先<router-link to="/register">注册?</router-link></p> </div> --> </el-form> </div> </div> </template>
时间: 2023-07-19 22:49:13 浏览: 43
这是一个 Vue.js 的模板代码,用于实现一个后台管理系统的登录页面。页面包括一个标题图片、账号和密码输入框,以及一个登录按钮。其中,使用了 Element UI 的表单组件和按钮组件。在提交表单时,会触发 submitForm 方法进行验证和提交操作。如果用户没有账号,可以通过页面中注释掉的代码链接到注册页面。
相关问题
<template> <div class="contact-us-container"> <h1>联系我们</h1> <div class="form-group"> <label style="text-align: center">Name:</label> <span style="text-align: center">{{name}}</span> </div> <div class="form-group"> <label style="text-align: center">Email:</label> <span >{{email}}</span> </div> <div class="form-group"> <label>Message:</label> <span >{{message}}</span> </div> </div> </template>把这个样式调好看
<>
<div class="contact-us-container">
<h1>联系我们</h1>
<div class="form-group">
<label>姓名:</label>
<span>{{name}}</span>
</div>
<div class="form-group">
<label>邮箱:</label>
<span>{{email}}</span>
</div>
<div class="form-group">
<label>留言:</label>
<span>{{message}}</span>
</div>
</div>
</template>
<style>
.contact-us-container {
display: flex;
flex-direction: column;
align-items: center;
}
h1 {
font-size: 2rem;
margin-bottom: 2rem;
}
.form-group {
margin-bottom: 1rem;
display: flex;
flex-direction: column;
align-items: center;
}
label {
font-size: 1.2rem;
margin-bottom: 0.5rem;
}
span {
font-size: 1.2rem;
padding: 0.5rem;
border: 1px solid #ccc;
border-radius: 5px;
min-width: 300px;
text-align: center;
}
</style>
<template> <div class="container"> <div class="detail-wrap"> <img :src="imgSrc" alt=""> <div> <h1>{{ msg }}</h1> <p><span>¥</span><span>{{ price }}</span></p> <div><input type="number" v-model="num"></div> <button v-on:click="addToCart">加入购物车</button> </div> </div> </div> </template>这是GoodsDetail01,<template> <div class="container"> <div class="detail-wrap"> <img :src="imgSrc" alt=""> <div> <h1>{{ msg }}</h1> <p><span>¥</span><span>{{ price }}</span></p> <div><input type="number" v-model="num"></div> <button v-on:click="addToCart">加入购物车</button> </div> </div> </div> </template>这是GoodsDetail02,这是<template > <div class="product-wrap" > <div class="product" v-for="product in products" :key="product.id" @click="handleClick(product.id)"> <img :src="product.image" alt="" > <div> <span>{{ product.name }}</span> <h4>¥{{ product.price }}</h4> </div> <component :is="currentComponent"></component> </div> </div> </template>这是goodslist商品主页,实现goodslist点击跳转到GoodsDetail01和GoodsDetail02,请用动态组件实现跳转,写出vue.app和goodslist代码
Vue.app代码如下:
```html
<template>
<div id="app">
<router-view></router-view>
</div>
</template>
<script>
export default {
name: "App",
};
</script>
```
goodslist代码如下:
```html
<template>
<div>
<h2>商品列表</h2>
<div class="product-wrap">
<div class="product" v-for="product in products" :key="product.id" @click="handleClick(product.id)">
<img :src="product.image" alt="">
<div>
<span>{{ product.name }}</span>
<h4>¥{{ product.price }}</h4>
</div>
</div>
</div>
<component :is="currentComponent"></component>
</div>
</template>
<script>
import GoodsDetail01 from "./GoodsDetail01.vue";
import GoodsDetail02 from "./GoodsDetail02.vue";
export default {
name: "GoodsList",
components: {
GoodsDetail01,
GoodsDetail02,
},
data() {
return {
products: [
{
id: 1,
name: "商品1",
price: 100,
image: "https://via.placeholder.com/150",
},
{
id: 2,
name: "商品2",
price: 200,
image: "https://via.placeholder.com/150",
},
],
currentComponent: "",
};
},
methods: {
handleClick(id) {
if (id === 1) {
this.currentComponent = "GoodsDetail01";
} else if (id === 2) {
this.currentComponent = "GoodsDetail02";
}
},
},
};
</script>
```