vue指令(代码部分三)

html 复制代码
<template>
	<view>
		<view @click="onClick">标题:{{title}}</view>
		<input type="text" v-model="title"/>
		----------------案例----------------
		<view class="out">
			<view class="row">
				<input class="border" type="text" placeholder="请输入姓名..." v-model="message.username">
			</view>
			<view class="row">
				<input class="border" type="text" placeholder="请输入联系人..." v-model="message.tel">
			</view>
			<view class="row">
				<textarea class="border" placeholder="请输入留言内容..." v-model="message.content"></textarea>
			</view>
			<view class="row">
				<button type="primary" @click="onSubmit">提交留言</button>
			</view>
		</view>
		{{message}}
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title:"uniapp",
				message:{
					username:"",
					tel:"",
					content:""
				}
			};
		},
		methods:{
			onClick(){
				this.title=Math.random()
			},
			onSubmit(){
				console.log(this.message)
			}
			
		}
		
	}
</script>

<style lang="scss">
.out{
	padding: 30rpx;
	.row{
		margin-bottom: 10rpx;
	}
	.border{
		border: 1px solid #eee;
		width: 100%;
		min-height: 80rpx;
		padding: 0 20rpx;
		box-sizing: border-box;
	}
}
</style>
相关推荐
nece00115 小时前
vue3杂记
前端·vue
Coder_Boy_15 小时前
基于SpringAI的在线考试系统设计总案-知识点管理模块详细设计
android·java·javascript
Carry34515 小时前
不清楚的 .gitignore
前端·git
张鑫旭15 小时前
AI时代2025年下半年学的这些Web前端特性有没有用?
前端·ai编程
pinkQQx15 小时前
H5唤醒APP技术方案入门级介绍
前端
Lefan15 小时前
UniApp 隐私合规神器!一键搞定应用市场审核难题 - lf-auth 隐私合规助手
前端
Null15515 小时前
浏览器唤起桌面端应用(进阶篇)
前端·浏览器
Jing_Rainbow15 小时前
【Vue-2/Lesson62(2025-12-10)】模块化与 Node.js HTTP 服务器开发详解🧩
前端·vue.js·node.js
风度前端16 小时前
用了都说好的 uniapp 路由框架
前端
冴羽16 小时前
2026 年 Web 前端开发的 8 个趋势!
前端·javascript·vue.js