Vue3文档 https://cn.vuejs.org/guide/introduction.html
(自我复习笔记 不适合0基础人查看)
DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Documenttitle>
<script src="./js/vue3.js">script>
head>
<body>
<div id="counter">
<h1>counter: {
{ num }}h1>
div>
<script>
const Counter = {
data() {
return {
num: 0,
};
},
};
// 创建一个应用,将配置的对象Counter的内容,渲染到选择器是#counter的元素上
Vue.createApp(Counter).mount("#counter");
script>
body>
html>
npm init vite-app vue3demo02
<template>
<h1>{
{ msg }}h1>
template>
<script>
// 命令式
// document.querySelector("h1").innerHTML = "hello";
// 声明式
export default {
name: "App",
data() {
return {
msg: "helloworld",
};
},
};
script>
<template>
<h1>{
{ msg }}h1>
<i