【vue演练场安装 element-plus框架】

在线vue 演练场地址:

https://play.vuejs.org/

配置element-plus js map :

import Map:

javascript 复制代码
{

  "imports": {

    "vue": "https://cdn.jsdelivr.net/npm/@vue/runtime-dom@3.4.0-beta.1/dist/runtime-dom.esm-browser.prod.js",

    "vue/server-renderer": "https://cdn.jsdelivr.net/npm/@vue/server-renderer@3.4.0-beta.1/dist/server-renderer.esm-browser.js",

    "element-plus": "https://unpkg.com/element-plus@2.4.3/dist/index.full.mjs"

  },

  "scopes": {}

}

css导入 用 <style> 标签@import url解决:

App.vue:

html 复制代码
<script setup>
import { defineComponent, ref, getCurrentInstance } from 'vue'
import Comp from './Comp.vue'
import ElementPlus from 'element-plus'

getCurrentInstance().appContext.app.use(ElementPlus)

const msg = ref('Hello World!')
const value1 = ref('')
</script>

<template>
  <div>
    <el-button>{{ msg }}</el-button>
    <div class="block">
      <el-date-picker v-model="value1" type="datetime" placeholder="Select date and time"></el-date-picker>
    </div>
    <el-dropdown>
      <span class="el-dropdown-link">
        Dropdown List
        <el-icon class="el-icon--right">
          <arrow-down />
        </el-icon>
      </span>
      <template #dropdown>
        <el-dropdown-menu>
          <el-dropdown-item>Action 1</el-dropdown-item>
          <el-dropdown-item>Action 2</el-dropdown-item>
          <el-dropdown-item>Action 3</el-dropdown-item>
          <el-dropdown-item disabled>Action 4</el-dropdown-item>
          <el-dropdown-item divided>Action 5</el-dropdown-item>
        </el-dropdown-menu>
      </template>
    </el-dropdown>
    <Comp></Comp>
  </div>
</template>

<style >
   @import url("https://unpkg.com/element-plus@2.4.3/dist/index.css")
</style>

app.vue中 全局install element-plus组件:

javascript 复制代码
import ElementPlus from 'element-plus'
 
getCurrentInstance().appContext.app.use(ElementPlus)
相关推荐
Maimai1080825 分钟前
React 多步骤表单工程化落地:从 Zod Schema、React Hook Form 到 Zustand 持久化
前端·javascript·react.js·前端框架·状态模式
程序员码歌26 分钟前
我是怎么部署开源 AI 编程助手 OpenCode,并在两个真实场景使用起来的
前端·人工智能·后端
Maimai1080828 分钟前
React Query + Zustand 正确结合方式:不要把接口数据复制进 Store
前端·javascript·react.js·前端框架·web3·状态模式
天才熊猫君30 分钟前
层叠上下文 z-index 的简单理解
前端
i220818 Faiz Ul31 分钟前
智慧养老平台|基于SprinBoot+vue的智慧养老平台系统(源码+数据库+文档)
java·前端·数据库·vue.js·spring boot·毕设·智慧养老平台
AI砖家31 分钟前
每日一个skill:web-artifacts-builder,构建复杂 Claude.ai HTML Artifact 的生产力工具包
java·前端·人工智能·python
icc_tips34 分钟前
Flutter runAppAsync() 详解:干净的异步应用启动
前端·flutter
转转技术团队35 分钟前
AI新名词比我头发掉得还快
前端
Lkstar35 分钟前
Pinia 进阶:Setup Store、插件系统与状态持久化,一篇全搞懂
前端·vue.js
yzin36 分钟前
cjs 和 esm 的差异总结&最佳实践
前端·javascript