• Vue3二维码生成(简洁明了)


    一、装上插件

    npm install --save qrcode.vue

    或者

    yarn add qrcode.vue

    二,引入插件到页面中

    import QrcodeVue from 'qrcode.vue'

    三,页面实现

     <qrcode-vue :value="qrCode123" size:300  >qrcode-vue>

    :value="qrCode123"是二维码中的值

    四 ,全部代码

    1. <template>
    2. <el-button text @click="dialogVisible = true"
    3. >click to open the Dialog
    4. >
    5. <el-dialog
    6. v-model="dialogVisible"
    7. title="Tips"
    8. width="30%"
    9. :before-close="handleClose"
    10. >
    11. <qrcode-vue :value="qrCode123" size:300 >qrcode-vue>
    12. <template #footer>
    13. <span class="dialog-footer">
    14. <el-button @click="dialogVisible = false">Cancelel-button>
    15. <el-button type="primary" @click="dialogVisible = false"
    16. >Confirm
    17. >
    18. span>
    19. template>
    20. el-dialog>
    21. template>
    22. <script lang="ts" setup>
    23. import { ref } from 'vue'
    24. import { ElMessageBox } from 'element-plus'
    25. import QrcodeVue from 'qrcode.vue'
    26. const dialogVisible = ref(false)
    27. const qrCode123 = ref("我是二维码信息")
    28. const handleClose = (done: () => void) => {
    29. ElMessageBox.confirm('Are you sure to close this dialog?')
    30. .then(() => {
    31. done()
    32. })
    33. .catch(() => {
    34. // catch error
    35. })
    36. }
    37. script>
    38. <style scoped>
    39. .dialog-footer button:first-child {
    40. margin-right: 10px;
    41. }
    42. style>

    Vue3介绍(不用理会)

    vue3.0带来了什么
    1.性能的提升
    打包大小减少41%
    初次渲染快55%,更新渲染块133%
    内存减少54%
    ........
    2.源码的升级
    使用Proxy代替defineProperty实现响应式
    重写虚拟DOM的实现和Tree-Sharking
    ......
    3.拥抱TypeScript
    vue3.0更好的支持TypeScript
    4.新的特性
    Composition API(组合api)

    。 setup配置

    。ref与reactive

    。watch与watchEffect

    。 provide和inject

    。 .......

    新的内置组件

    Fragment

    。Teleport

    。Suspense

    其他改变

    。新的生命周期钩子

    。data选项应始终被声明为一个函数

    。移除keyCode支持作为v-on的修饰符

  • 相关阅读:
    C++ std::string 删除指定字符
    使用tesseract-ocr实现图片中的中英文字符提取
    SAP FI/SD的集成-VKOA科目确定
    golang validator基于map规则验证集合和结构体
    LeetCode/LintCode 题解丨一周爆刷字符串:乱序字符串
    同花顺_代码解析_交易系统_J01_08
    windows查看登陆的IP
    Xilinx ZYNQ 7000学习笔记四(MultiBoot多重启动)
    uniapp条件编译
    垂直领域大模型落地思考
  • 原文地址:https://blog.csdn.net/QQ675396947/article/details/126663952