<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Vue 3 Image Demo</title>
    <script src="https://unpkg.com/vue@next"></script>
</head>
<body>
<div id="app">
  <img :src="imageSrc" alt="Vue 3 Image">
</div>
<script>
  const App = {
    setup() {
      const imageSrc = Vue.ref('https://via.placeholder.com/350x150');
      return {
        imageSrc
      }
    }
  }
  Vue.createApp(App).mount('#app')
</script>
</body>
</html>
Vue 3 图片插入示例:使用 script setup 和 ref 响应式变量

原文地址: https://www.cveoy.top/t/topic/mC0M 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录