[HDU 1269] Lysaka Castle Strong Connect

2023-01-12   ES  

* Vue version is 1.0

vue cycle data repeatedly resolved

v-for specify, when recycling data, repeated data will be deleted,

vue1.0: As long as you addtrack-by=“$index” <li v-for=’value in arr’ track-ty=’$index’></li>

vue2.0+: You need to get Index on V-FOR, for example: <li V-FOR = ‘(Value, Index) in Arr’ Track-TY = ‘Index’> </li>

vue loaded to avoid users see {{}} Flower brackets

1> Vue1.0 use V-Cloak, where the boners are used

Definition in

css:[v-cloak]{display:none;}, add <div ID = ‘Box’ V-Cloak> {to the node{msg}}</div>

2> Use the V-TEXT instruction to replace {{text}} Flower bracket

3> Use V-HTML instructions to replace {{
{html}}} The righteousness of the righteousness

	Vue custom filter
vue1.0 provides its own filter, Limitby, Orderby, etc., custom filter syntax in Vue:
Vue.filter(name,function(input){
			return xxx;
		});

For example:

<script src="lib/vue2.0.js"></script>
</head>
<body>
    <div id="box">
        {
    {a|toDou}}
    </div>
</body>
<script>
    Vue.filter('toDou',function (input) {
        return input<10?'0'+input:''+input;
    })
    var vm=new Vue({
        data:{
            a:9
        },
        methods:{

        }
    }).$mount('#box');
</script>

vue two -way filter

<script src="lib/vue.js"></script>
    <script>
        //<h2>welcome</h2>
        Vue.filter('filterHtml',{
            read:function(input){ //model-view
                return input.replace(/<[^<]+>/g,'');
            },
            write:function(val){ //view -> model
                console.log(val);
                return val;
            }
        });
        window.οnlοad=function(){
            var vm=new Vue({
                data:{
                    msg:'<strong>welcome</strong>'
                }
            }).$mount('#box');
        };

    </script>
</head>
<body>
<div id="box">
    <input type="text" v-model="msg | filterHtml">
    <br>
    {
    {
    {msg}}} // Export HTML to 
 </div> 

 The results of the

output are: welcome

Supervision data changes
vm. $ Watch (name, fncb); // shallow degree
<script >
    var vm = new Vue({
        data:{
            a:111,
            b:22
        }
    }).$mount('#box');
    vm.$watch('a',function () {
        this.a = this.a+1;
    });
    document.onclick = function () {
        vm.a = 1;
    };
</script>

vm. $ Watch (name, fncb, {deep: true}); // In -depth monitoring, the attribute changes can be heard

Window.#nlοAd = Function () { 
         var vm = new vue ({ 
             EL: '#Box', 
             Data: { 
                 json: {name: 'strive', Age: 16}, 
                 B: 2 
             } 
         }); 

         vm. $ watch ('json', function () { 
             alert ('The change has changed'); 
         }, {Deep: true}); 

         document.lnClight = Function () { 
             vm.json.name = 'AAA'; 
         }; 
     };

source

Related Posts

Python list commonly used operation The

ubuntu18.04 Install Fast-DDS-PYTHON and use case reference

Little Bai Xue Python —— Use Baidu Translation API to achieve translation function

Install VS2010 Chinese flagship version of Deepwater

[HDU 1269] Lysaka Castle Strong Connect

Random Posts

vue2.0 template Handsome

SUBLIME Text formatting JSON-PRETTY JSON

jacksonUtil工具类b

1 feature extract Ghost

minimum generation tree -template scar