再猜想一下,div这个能不能放在模板中,在vite中就可以运行?不用引用vue

news/2024/7/10 0:21:11 标签: vue

尚不知道

尝试失败,没有成功。
把这段代码放到component的HelloWorld.vue里了,没有成功

<!--
 * @,@Author: ,: your name
 * @,@Date: ,: 2021-04-02 09:52:24
 * @,@LastEditTime: ,: 2021-04-02 09:58:40
 * @,@LastEditors: ,: Please set LastEditors
 * @,@Description: ,: In User Settings Edit
 * @,@FilePath: ,: /hami35/src/components/HelloWorld.vue
 -->
<template>
<div id="event-handling">
  <p>{{ message }}</p>
  <button v-on:click="reverseMessage">反转 Message</button>
</div>
</template>

<script setup>
import { defineProps, reactive } from 'vue'

const EventHandling = {
  data() {
    return {
      message: 'Hello Vue.js!'
    }
  },
  methods: {
    reverseMessage() {
      this.message = this.message
        .split('')
        .reverse()
        .join('')
    }
  }
}

Vue.createApp(EventHandling).mount('#event-handling')
</script>

<style scoped>
a {
  color: #42b983;
}
</style>

为什么呢,应该怎么改的?


http://www.niftyadmin.cn/n/957824.html

相关文章

centos 8各iso之间的区别

在centos 8的下载目录中通常会看到如下几个文件&#xff1a; boot.iso DVD1.iso minimal.iso 初次接触的人可能会不知道该如何选择&#xff0c;下面我给大家简要介绍一下。 boot.iso看文件大小只有600多M&#xff0c;这个镜像只有基本启动引导等内容&#xff0c;安装期间的…

tensorflow载入报错Process finished with exit code -1073741819 (0xC0000005)

我是因为安装opencv导致的错误&#xff0c;幸好有备份&#xff0c;用原来没有装opencv的虚拟环境就行&#xff0c;下面的文章有参考价值 https://blog.csdn.net/peach_orange/article/details/82777448

java url 获取文件_[转]从URL获取文件保存到本地的JAVA代码,url 请求设置http请求头

url下载文件的地方.参数需要 urlencode..否则会下载不到. ​​​​​​​java url 获取文件_[转]从URL获取文件保存到本地的JAVA代码,url 请求设置http请求头public boolean saveUrlAs(String photoUrl, String fileName) { //此方法只能用户HTTP协议try {URL url new URL(pho…

vue3的代码改成vue2的转换

vue3 <!DOCTYPE html> <html> <head> <meta charset"utf-8"> <title>Vue的方法_侠课岛(9xkd.com)</title><script src"https://unpkg.com/vuenext"></script> </head> <body><div id&quo…

tf.gfile.FastGFile

tf.gfile.FastGFile(path,decodestyle) 函数功能&#xff1a;实现对图片的读取。 函数参数&#xff1a;(1)path&#xff1a;图片所在路径&#xff0c;注意带后缀(2)decodestyle:图片的解码方式。(‘r’:UTF-8编码; ‘rb’:非UTF-8编码)&#xff01; import matplotlib.pyplo…

这样写也可以,两个const,console.log值在devstool工具里浏览器里,4

<!DOCTYPE html> <html> <head> <meta charset"utf-8"> <title>Vue的方法_侠课岛(9xkd.com)</title><script src"https://unpkg.com/vuenext"></script> </head> <body><div id"coun…

手动更新nacos服务:nacos实时读取配置(

url下载文件的地方.参数需要 urlencode..否则会下载不到. //手动更新nacos服务: curl -X PUT http://192.168.1.201:8848/nacos/v1/ns/service?serviceNameescp-order&groupNameDEFAULT_GROUP&namespaceIdlocal //nacos实时读取配置(不实时读取的话,会有缓存,不能即使…

TensorFlow和Keras解决大数据量内存溢出问题

内存溢出问题是参加kaggle比赛或者做大数据量实验的第一个拦路虎。 以前做的练手小项目导致新手产生一个惯性思维——读取训练集图片的时候把所有图读到内存中&#xff0c;然后分批训练。 其实这是有问题的&#xff0c;很容易导致OOM。现在内存一般16G&#xff0c;而训练集图…