You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.1 KiB
37 lines
1.1 KiB
<!DOCTYPE html> |
|
<html lang="en"> |
|
<head> |
|
<meta charset="UTF-8"> |
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
|
<link rel="stylesheet" href="https://unpkg.com/element-plus/dist/index.css"/> |
|
<script src="https://unpkg.com/vue@3.2.24/dist/vue.global.js"></script> |
|
<!-- 引入element plus样式 --> |
|
<link rel="stylesheet" href="https://unpkg.com/element-plus/dist/index.css"/> |
|
<script src="https://unpkg.com/element-plus"></script> |
|
<title>v-model</title> |
|
</head> |
|
<body> |
|
<div id="app"> |
|
<input type="text" v-model="tips"> |
|
<h2>{{ tips }}</h2> |
|
<!-- <input type="button" value="修改" @click="change_tips">--> |
|
<el-button type="primary" @click="change_tips">修改</el-button> |
|
</div> |
|
<script type="text/javascript"> |
|
const App = { |
|
data() { |
|
return { |
|
tips: "初始的文本信息", |
|
btn_tips: "点击按键后的信息" |
|
} |
|
}, |
|
methods: { |
|
change_tips: function () { |
|
this.tips = this.btn_tips |
|
} |
|
} |
|
} |
|
Vue.createApp(App).use(ElementPlus).mount("#app") |
|
</script> |
|
</body> |
|
</html>
|
|
|