Vue_Notebook/3.3/Vue3Proj/vue-project/src/Vue2_1.vue

37 lines
1.1 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<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>