webpack 的 externals :

module.exports = {
  //...
  externals: {
    jquery: 'jQuery',
    "mint-ui":"?"
  }
};

mint-ui这里该填什么?如何结合webpack的externals技巧排除?

2020-11-20 18:59创建
共1个回答
AD
游客AdtNgf

全局变量叫 nutui,会挂载到window对象下。cdn的使用示例如下:

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- 引入样式 -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@nutui/nutui@2.2.0/dist/nutui.min.css">
</head>
<body>
    <div id="app">
        <nut-button @click="showDialog">
            Button
        </nut-button>
    </div>

    <!-- 引入Vue -->
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.min.js"></script>
    <!-- 引入NutUI组件库 -->
    <script src="https://cdn.jsdelivr.net/npm/@nutui/nutui@2.2.0/dist/nutui.min.js"></script>
    <script>
        console.log(window.nutui)
        new Vue({
            el: '#app',
            methods: {
                showDialog() {
                    this.$dialog({
                        title: "确定删除此订单?",
                        content: "删除后将从你的记录里消失,无法找回"
                    });
                }
            }
        });
    </script>
</body>
</html>