uni-app 语法

  • v:on click

    <button type="primary" v-on:click="clinkHandle(20, $event)">Button</button>
    => v-on = @
    <button type="primary" @click="clinkHandle(20, $event)">Button</button>
    
    methods: {
    	clickHandle(num, e) {
    		console.log(num, e);
    	}
    }

    数据展示

  • template中通过{ {数据}}显示数据

  • 标签属性通过 :data-index = '数据' 显示数据

<template>
	<view>
		<view>{
   
   {msg}}</view>
		<view :data-color="color">color</view>
    <view>{
   
   {person.name}}</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				msg: "this is a message",
				color: "red",
        person: {
					name:"bill",
					sex: "male"
				}
			}
		}
	}
</script>

<!--显示结果-->
this is a message
color
bill

猜你喜欢

转载自blog.csdn.net/A_bad_horse/article/details/113103822