课程3.3:Vue项目导入与基础语法学习,代码上传
This commit is contained in:
37
3.3/Vue3Proj/vue-project/src/Vue2_1.vue
Normal file
37
3.3/Vue3Proj/vue-project/src/Vue2_1.vue
Normal file
@@ -0,0 +1,37 @@
|
||||
<template>
|
||||
<div>
|
||||
<p>1.文本插值:图书名称是{{ bookName }}。</p>
|
||||
<p>2.使用v-html指令:<span v-html="htmlCode"></span></p>
|
||||
<p>
|
||||
3.使用v-bind指令:<a v-bind:href="url" v-bind:title="content"
|
||||
>国家智慧教育公共服务平台</a
|
||||
>
|
||||
</p>
|
||||
<p>4.1数值表达式绑定:9+(3+6)*4/2={{ 9 + ((3 + 6) * 4) / 2 }}</p>
|
||||
<p>
|
||||
4.2函数表达式绑定:若x={{ x }},则x<sup>2</sup>+2x+1={{
|
||||
Math.pow(x, 2) + 2 * x + 1
|
||||
}}
|
||||
</p>
|
||||
<p>
|
||||
4.3条件表达式绑定:若flag值为{{ flag }},则我的选择是"{{
|
||||
flag ? "确定" : "取消"
|
||||
}}"。
|
||||
<button @click="flag = !flag">改变{{ flag }}</button>
|
||||
</p>
|
||||
<p>5.语句不会生效:var y = 2025</p>
|
||||
<!-- {{ var y = 2025 }} -->
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang='ts'>
|
||||
import { reactive, ref } from "vue";
|
||||
const bookName = "Vue.js前端框架技术与实战";
|
||||
const htmlCode = "<h1>使用em标记的显示内容的效果!</h1>";
|
||||
const url = "https://www.smartedu.cn/";
|
||||
const content = "智慧教育";
|
||||
const x = 10;
|
||||
const flag = ref(true);
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
</style>
|
||||
Reference in New Issue
Block a user