vue开发必须要搭脚手架么?


当前第2页 返回上一页

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

<!DOCTYPE html>

<html>

<head>

    <meta charset="UTF-8">

    <title>Title</title>

    <script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script>

    <script src="https://unpkg.com/vuex@3.0.1/dist/vuex.js"></script>

</head>

<div id="app"></div>

<body>

    <script type="text/Template" id="tpl">

        <div>

            <tip></tip>

            <input type="button" value="+" @click="jia" />

            <input type="button" value="-" @click="jian" />

        </div>

    </script>

    <script>

        const VuexStore = new Vuex.Store({

            state: {

                count: 0,

                num1: 1,

                num2: 2

            },

            mutations: {

                add(state, arg) {

                    state.count += arg.amount;

                },

                reduce(state) {

                    state.count --;

                }

            },

            getters: {

                he(state,getters) {

                    return state.count + state.num1 + state.num2

                },

                add5(state) {

                    return state.count + 0

                }

            },

            actions: {

                add_act({commit}) {

                    commit({type:'add', amount:5})

                },

                reduce_act({commit}) {

                    commit({type:'reduce'})

                }

            },

            modules: {

 

            }

        });

        const app = new Vue({

            el: '#app',

            store: VuexStore,

            template: '#tpl',

            components: {

                tip: {

                    computed: {

                        ...Vuex.mapState(['count','num1','num2']),

                        // ...Vuex.mapGetters(['he'])代替了$store.getters.he

                        ...Vuex.mapGetters(['he']),

                    },

                    template: '<div>{{count}}-{{num1}}-{{num2}}={{he}}</div>'

                }

            },

            methods: {

                // ...Vuex.mapMutations(['add'])代替了$store.commit('add')

//                ...Vuex.mapMutations(['add','reduce']),

                ...Vuex.mapActions(['add_act', 'reduce_act']),

                jia() {

//                    this.$store.commit({type:'add',amount:100})

//                    this.$store.dispatch('add_act');

                        this.add_act();

//                    this.add({amount:100});

                },

                jian() {

//                    this.$store.commit('reduce');

//                    this.$store.dispatch('reduce_act');

                        this.reduce_act();

//                    this.reduce();

                }

            }

        })

    </script>

</body>

</html>

至于router案例:https://github.com/vuejs/vue-router/tree/dev/examples

扩展资料:

CDN的全称是Content Delivery Network,即内容分发网络。CDN是构建在现有网络基础之上的智能虚拟网络,依靠部署在各地的边缘服务器,通过中心平台的负载均衡、内容分发、调度等功能模块,使用户就近获取所需内容,降低网络拥塞,提高用户访问响应速度和命中率。CDN的关键技术主要有内容存储和分发技术。

CDN具有以下主要功能:

(1)节省骨干网带宽,减少带宽需求量;

(2)提供服务器端加速,解决由于用户访问量大造成的服务器过载问题;

(3)服务商能使用Web Cache技术在本地缓存用户访问过的Web页面和对象,实现相同对象的访问无须占用主干的出口带宽,并提高用户访问因特网页面的相应时间的需求;

(4)能克服网站分布不均的问题,并且能降低网站自身建设和维护成本;

(5)降低“通信风暴”的影响,提高网络访问的稳定性。

相关推荐:

2020年前端vue面试题大汇总(附答案)

vue教程推荐:2020最新的5个vue.js视频教程精选

更多编程相关知识,请访问:编程教学!!

以上就是vue开发必须要搭脚手架么?的详细内容,更多文章请关注木庄网络博客

返回前面的内容

相关阅读 >>

深入了解vue中的计算属性

vue 中如何动态添加 readonly 属性

基于vue移动端ui框架有哪些?

如何理解vue中的全局组件和局部组件

vue基于iview table展示图片实现点击放大功能

2021年值得收藏的17个vue 后台管理模板

vue界面刷新不显示怎么办

使用vue.js如何实现轮播

一起看看v-for中key属性的作用!

单独引入vue.js文件怎么写组件

更多相关阅读请进入《vue》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...